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