description | ms.date | ms.topic | title |
---|---|---|---|
Reference for the 'sub' DSC configuration document function |
03/20/2024 |
reference |
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://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Subtract integers
type: Test/Echo
properties:
output: "[sub(7, 3)]"
dsc config get --document sub.example.1.dsc.config.yaml config get
results:
- name: Subtract integers
type: Test/Echo
result:
actualState:
output: 4
messages: []
hadErrors: false
The 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: 2
The sub()
function returns an integer representing the difference of the operands.
Type: integer