Difference between revisions of "Control flow: If clause"
(→Introduction: Minor typo. Changed "End IF" to "End If" near top.) Tags: Mobile web edit Mobile edit |
(→Introduction: Else If description (how to add): removed 'set variable menu') Tags: Mobile web edit Mobile edit |
||
| Line 4: | Line 4: | ||
''' If statement ''' | ''' If statement ''' | ||
| − | The '''If''' statement is available form the ‘Add | + | The '''If''' statement is available form the ‘Add Action above’ menu item (‘Conditions/Loops’) and comes along with a terminating '''End If'''. |
This action allows to execute a set of subsequent actions according to specific condition(s). The possible conditions are the same as constraints and are tested in exactly the same way, with logical connectors 'AND' (default one) or 'OR' in case of multiple conditions. | This action allows to execute a set of subsequent actions according to specific condition(s). The possible conditions are the same as constraints and are tested in exactly the same way, with logical connectors 'AND' (default one) or 'OR' in case of multiple conditions. | ||
| Line 12: | Line 12: | ||
''' Else statement ''' | ''' Else statement ''' | ||
| − | '''Else''' will only become available by selecting the '''If''' statement again and then selecting the ‘Add else clause’ from the | + | '''Else''' will only become available by selecting the '''If''' statement again and then selecting the ‘Add else clause’ from the menu. |
| − | In case further constrains should be invoked ‘Add else/ | + | In case further constrains should be invoked ‘Add else/if clause’ or ‘Add else/if confirmed clause’ can be used. |
'''If''' statements my be nested that is within '''If''' and '''End If''' there might be other pairs of '''If''' and '''End If'''. | '''If''' statements my be nested that is within '''If''' and '''End If''' there might be other pairs of '''If''' and '''End If'''. | ||
Latest revision as of 01:50, 3 April 2026
Introduction
If statement
The If statement is available form the ‘Add Action above’ menu item (‘Conditions/Loops’) and comes along with a terminating End If.
This action allows to execute a set of subsequent actions according to specific condition(s). The possible conditions are the same as constraints and are tested in exactly the same way, with logical connectors 'AND' (default one) or 'OR' in case of multiple conditions.
In case the condition is met and a number of subsequent actions should be executed while different actions should be executed if the condition was not met an Else statement has to be implemented.
Else statement
Else will only become available by selecting the If statement again and then selecting the ‘Add else clause’ from the menu. In case further constrains should be invoked ‘Add else/if clause’ or ‘Add else/if confirmed clause’ can be used.
If statements my be nested that is within If and End If there might be other pairs of If and End If.
MacroDroid Variable/Compare Values
=
Means that the whole content of the string variable has to be equal to the whole set of typed characters.
Compatible with Variables | String, Integer, Decimal, Boolean (Boolean only in the compare values condition/constraints)
!=
Means that the content of the string variable has to be unequal (i.e. different) to the set of typed characters.
Compatible with Variables | String, Integer, Decimal, Boolean (Boolean only in the compare values condition/constraints)
Contains
Means that the content of the string variable has to contain the whole set of typed character. For instance, enter the word information to match with a string variable containing the text: Here are the informations you asked for...
Compatible with Variables | String
Excludes
Means that the content of the string variable has not to contain the typed text.
Compatible with Variables | String
The wildcards '*' and '?'
*
* stands for any number of character (from 0 to any, same as '.*' in Regex).
?
? is for 1 and only 1 mandatory character (same as '.{1}' in Regex).
- Tick the box Enter regular expression matching if the typed text follows Regex syntax, far more powerful than plain text with or without wildcards (for advanced users).