beautypg.com

Ifelse – AMT Datasouth PAL User Manual

Page 120

background image

ifelse

114

ifelse

Description

Conditionally executes one of two procedures based upon a boolean value.

Usage

AnyBool TrueProc FalseProc

ifelse

AnyBool

Boolean. Value which determines whether or not PAL executes TrueProc or
FalseProc. A value of true instructs the interpreter to execute TrueProc. A
value of false instructs PAL to execute FalseProc.

TrueProc

Procedure. The procedure for PAL to execute given a value of true for
AnyBool.

FalseProc

Procedure. The procedure for PAL to execute given a value of false for
AnyBool.

Comments

This operator provides the PAL programmer with the ability to execute one of two procedures.
Typically the boolean value AnyBool would result from the execution of a comparison operator
like eq or gt.

The ifelse operator removes all three parameters from the stack before invoking the selected pro-
cedure. The ifelse operator does not place any results onto the stack. However, the executed pro-
cedure may place one or more results onto the stack if desired.

Hints

The if operator discussion includes hints which also apply to the ifelse operator.