Jump to navigation Jump to search
- This operator creates a If Type which is used in the if-construct as described here.
- Program Flow
- if condition
- condition: Boolean - if it evaluates as true, the then clause is executed. Otherwise, the else clause (if present) is executed
- Return Value:
- If Type - predicate which will execute 1st or 2nd option when used. This predicate is used in then or exitWith commands
- Example 1:
- Example 2:
- Posted on Jan 31, 2007 - 04:08 (UTC)
- Any _local variables you declare within the body of an if/then statement (ie between the curly braces) are local to that 'if' statement, and are destroyed at the end of the statement. If you know you want to use the variable outside the 'if' statement, make sure your declare it before the 'if' statement.
- Posted on Jan 17, 2010 - 02:40 (UTC)
If the condition is nil then neither the "then" nor the "else" section get executed, but the script will proceed with no error messages.
- Posted on Jun 05, 2015 - 09:35 (UTC)
- If you only need to choose between 2 raw values, it is possible to use the following trick to avoid using code blocks, as required by the if command, which results in greater atomicity and faster execution: