IF

Member Of Menu: 
Branch
Argument Types: 
None
Result Type(s): 
None
Invertible: 
No
Valid In Expression: 
No

The IF operation can be used within program execution context to control the flow of execution through the program. It is combined with the THEN, END and possibly the ELSE operation to form a IF control structure.

The normal way IF is used is one of the following:

≪ ... IF ... operations ... THEN ... operations ... END ... ≫

or

≪ ... IF ... operations ... THEN ... operations ... ELSE ... operations ... END ... ≫

During execution, the top value of the stack will be popped when THEN is reached. THEN expects to find a real value there. If the value is non zero, then the operations following the THEN is executed. The operations which may follow an optional ELSE in the program will be skipped if the THEN block of operations were executed. If the value popped from the stack at THEN is zero, execution continues after the ELSE if it is present. In all cases, execution will continue after the END block.

An error will be raised if this operation is used outside of program execution context.