| description | Reference for the 'sub' DSC configuration document function |
|---|---|
| ms.date | 02/28/2025 |
| ms.topic | reference |
| title | sub |
Returns the difference of two integers.
sub(<operands>)The sub() function returns the difference of two integers. It subtracts the second operand from the
first operand. You can nest calls to sub() to subtract more than two integers.
This example document shows how you can use the sub() function to return the difference of two
integers.
# sub.example.1.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Subtract integers
type: Microsoft.DSC.Debug/Echo
properties:
output: "[sub(7, 3)]"dsc config get --file sub.example.1.dsc.config.yaml config getresults:
- name: Subtract integers
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: 4
messages: []
hadErrors: falseThe sub() function expects exactly two integers as input. The operands can be either an
integer or the output of any configuration function that returns an integer. Separate the
operands with a comma (,).
Type: integer
Required: true
MinimumCount: 2
MaximumCount: 2The sub() function returns an integer representing the difference of the operands.
Type: integer