diff --git a/docs/creating-manifest/conditions-and-iterations.md b/docs/creating-manifest/conditions-and-iterations.md index 209a8774..a68b505d 100644 --- a/docs/creating-manifest/conditions-and-iterations.md +++ b/docs/creating-manifest/conditions-and-iterations.md @@ -1,5 +1,47 @@ # Control Flows: Conditions and Iterations +**Comparison** and **Logical** operators are used in *conditional* statements and serve to test for `ture` or `false`. + +## Comparison Operators + +The Comparison operators are used in logical statements to determine equality or difference between variables or values. + +Let's assume that `x = 5`. The table below explains the comparison operators: + +| Operator | Description | Comparing | Returns | +|--------------------|-------------------------------------|-----------|----------| +| == | equal to | x == 8 | false | +| == | equal to | x == 5 | true | +| == | equal to | x == "5" | true | +| | | | | +| === | equal value and equal type | x === 5 | true | +| === | equal value and equal type | x === "5" | false | +| | | | | +| != | not equal | x != 8 | true | +| | | | | +| !== | not equal value or not equal type | x !== 5 | false | +| !== | not equal value or not equal type | x !== "5" | true | +| !== | not equal value or not equal type | x !== 8 | true | +| | | | | +| > | grater than | x > 8 | false | +| < | less than | x < 8 | true | +| >= | grater than or equal to | x >= 8 | false | +| <= | less than or equal to | x <= 8 | true | + +## Logical Operators + +The logical operators are used to determine the logic between variables or values. Let's take that `x = 6` and `y = 3`. The table below explains the logical operators: + +| Operator | Description | Example | +|--------------------|-------------------------------------|------------------------------| +| && | and | (x < 10 && y > 1) is true | +| == | or | (x == 5 || y == 5) is false | +| == | not | !(x == y) is true | + + + + + ## Conditions The main conditional statement is *if*. Within this parameter, all the available placeholders and their objective JavaScript mappings can be used. @@ -204,7 +246,7 @@ onInstall: ``` @@! -### **Else** +### Else In case the conditional statement should be complemented by the opposite comparison and respective action the ***else*** conditional operator can be accommodated. @@ -431,6 +473,61 @@ onInstall: ``` @@! +### Single line *if* statement + +Another ***if-else*** combination can be represented as a single ***if*** statement when multiple conditions are required to be checked and the statements nesting is not mandatory. +It is applicable if any condition or all of the conditions in the statement may lead to the same outcome. +For example: + +@@@ +```yaml +type: install +name: '[CS:Conditions] - action single line "if"' + +globals: + a: 1 + b: 2 + +onInstall: +- log: "-- single line if test --" +- if ((globals.b == 2) && (globals.a == 1) && (globals.a == 1)): + assert: true + +- log: "-- another single line if test --" +- if (globals.a == 2 || globals.a == 3 || globals.a == 1): + assert: true +``` +```json +{ + "type": "install", + "name": "[CS:Conditions] - action single line \"if\"", + "globals": { + "a": 1, + "b": 2 + }, + "onInstall": [ + { + "log": "-- single line if test --" + }, + { + "if ((globals.b == 2) && (globals.a == 1) && (globals.a == 1))": { + "assert": true + } + }, + { + "log": "-- another single line if test --" + }, + { + "if (globals.a == 2 || globals.a == 3 || globals.a == 1)": { + "assert": true + } + } + ] +} +``` +@@! + + ## Iterations ### ForEach diff --git a/docs/creating-manifest/visual-settings.md b/docs/creating-manifest/visual-settings.md index 7cbd57f4..5a688f9f 100644 --- a/docs/creating-manifest/visual-settings.md +++ b/docs/creating-manifest/visual-settings.md @@ -81,7 +81,7 @@ where: * `text` - [multiline](#text) text field * `list` - drop-down menu with [textboxes](#list) * `checkbox` - [single checkbox](#checkbox) field - + * `checkboxlist` - [checkbox](#checkboxlist) grouping * `radiolist` - [radio field](#radiolist) grouping * `radio-fieldset` - alias to `radiolist` * `dockertags` - drop-down menu with a list of [docker tags](#dockertags) @@ -554,47 +554,72 @@ where: - `hideLabel` *[optional][boolean]* - shows/hides field label. Default value is *'false'* - `hidden` *[optional]*[boolean] - shows/hides field with its label. Default value is *'false'*. - +- `hidden` *[optional]*[boolean] - shows/hides field with its label. Default value is *'false'* +- `delimiter` *[optional][string]* - a delimiter character to separate list data items. The default value is a comma ',' +- `columns` *[optional][Number]* - specifies the number of columns to be created when displaying grouped checkboxlist controls using automatic layout. The default value is 1. + ### radiolist Radio elements grouping. diff --git a/theme/readthedocs/img/checkboxlist.jpg b/theme/readthedocs/img/checkboxlist.jpg index 2de0bfd8..edb9dae1 100644 Binary files a/theme/readthedocs/img/checkboxlist.jpg and b/theme/readthedocs/img/checkboxlist.jpg differ