1# if
2
3## Description
4Performs actions based on whether a condition is true.
5
6The "condition" property specifies an action to execute.  The condition is true
7if the action returns true.  Otherwise the condition is false.
8
9If the condition is true, the actions within the "then" property are executed.
10
11If the condition is false, the actions within the "else" property are executed
12(if specified).
13
14## Properties
15| Name | Required | Type | Description |
16| :--- | :------: | :--- | :---------- |
17| condition | yes | [action](action.md) | Action that tests whether condition is true. |
18| then | yes | array of [actions](action.md) | One or more actions to perform if condition is true. |
19| else | no | array of [actions](action.md) | One or more actions to perform if condition is false. |
20
21## Return Value
22If the condition was true, returns the value of the last action in the "then"
23property.
24
25If the condition was false, returns the value of the last action in the "else"
26property. If no "else" property was specified, returns false.
27
28## Example
29```
30{
31  "comments": [ "If regulator is downlevel use different configuration rule" ],
32  "if": {
33    "condition": {
34      "run_rule": "is_downlevel_regulator"
35    },
36    "then": [
37      { "run_rule": "configure_downlevel_regulator" }
38    ],
39    "else": [
40      { "run_rule": "configure_standard_regulator" }
41    ]
42  }
43}
44```
45