IFTE

Member Of Menu: 
Branch
Argument Types: 
Any
Real
Result Type(s): 
None
Invertible: 
No
Valid In Expression: 
No
Stack Diagram: 
Real1 Item2 Item3

The IFTE operation is an alternative to the IF operation. In this form, IFTE pops three values off the stack. The real value is tested to see if it is non-zero. If it is non-zero, then Item2 is evaluated. If the real value is zero, then Item3 is evaluated. If the item is an expression or program, it is executed which may result in one or more items being pushed onto the stack or any number of things happening.

This would often be used like this:

≪ ... PushSomeCondition ≪ ExecuteIfTrue ≫ ≪ ExecuteIfFalse ≫ IFTe ... ≫

In this case "PushSomeCondition" is one or more operations which result in a real value being pushed onto the stack. These operations may contain logical comparisons like ==. After that, a program for the true clause is pushed onto the stack which itself calls "ExecuteIfTrue" in this example followed by a program which calls "ExecuteIfFalse" for the false clause. When IFTe is executed, the two programs and real value are popped and the appropriate program is executed based on the value of the real number.