| description | Reference for the 'mod' DSC configuration document function |
|---|---|
| ms.date | 02/28/2025 |
| ms.topic | reference |
| title | mod |
Returns the remainder for the division of two numbers.
mod(<operands>)The mod() function returns the remainder for the division of two integers.
This example document shows how you can use the mod() function to return the remainder of a
division for two integers.
# mod.example.1.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Remainder for integers
type: Microsoft.DSC.Debug/Echo
properties:
output: "[mod(7, 5)]"dsc config get --file mod.example.1.dsc.config.yaml config getresults:
- name: Remainder for integers
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: 2
messages: []
hadErrors: falseThis configuration document uses the mod() function to get the remainder for diving the output of
two other mathematical operations.
# mod.example.2.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Remainder for nested functions
type: Microsoft.DSC.Debug/Echo
properties:
output: "[mod(add(9, 5), mul(6, 2))]"dsc config get --file mod.example.2.dsc.config.yamlresults:
- name: Remainder for nested functions
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: 2
messages: []
hadErrors: falseThe mod() 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. The function divides
the first operand by the second operand. Separate the operands with a comma (,).
Type: integer
Required: true
MinimumCount: 2
MaximumCount: 2The function returns an integer representing the remainder of the division operation for the operands.
Type: integer