Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. if(condition, trueExpression)
  2. if(condition, trueExpression, falseExpression)
ArgumentTypeDescription
conditionBooleanThe condition to be checked
trueExpressionAnyThe expression to be evaluated if condition is True
falseExpressionAnyAn 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.

...