...
- if(condition, trueExpression)
- if(condition, trueExpression, falseExpression)
Argument | Type | Description |
---|---|---|
condition | Boolean | The condition to be checked |
trueExpression | Any | The expression to be evaluated if condition is True |
falseExpression | Any | An optional expression to be evaluated if condition is False |
Note that if you want to process more than a one-line expression if condition evaluates to True or False then wrap the script in a do() function. See the examples below.
...
This example extends the example above to include an "else" clause i.e. the expressions that should be processed if the condition returns False.
Please note Note the layout in the last example. Consistent formatting of your scripts like this will can help clarify where the "else" script starts. Also see Scripting Style.
...