IF
Parameters
Returns
Copies the stack from the call onto the stack.
Description
This command runs the truefunction function if the condition is true.
This command runs the falsefunction function if the condition is false.
The condition is considered true in the following circumstances…
Data Type | True If |
---|---|
const | '1', 'True', 'Yes','y','t' |
list or map | Contains more than 0 items |
Note that the behaviour of GET and SET is slightly different when in the if. Calling set will only set a value for the nested function - you can't set values that will be accessible to the calling function.
However, GET can access information stored by any function in the calling hierarchy.
Example
To demonstrate the function, let's look at a simple example.
'TE101' ASSET RELS 'Location' RELATIONSHIP CONTAINS [ 'YES' ] [ 'NO' ] IF
This function will return 'Yes' if the asset TE101 is part of the Location hierarchy, or “No” if it isn't.