next up previous contents
Next: Lowercase Up: Programming Tools and Functions Previous: Boolean Evaluation

Short if-then-fi

Calling Sequence:
If (cond, exptrue, expfalse)
Parameters:
cond : boolean expression
exptrue, expfalse : an expression

Returns: The type which exptrue evalutates to or the type which expfalse evaluates to.

Synopsis: The If construct provids a short hand version of the if-then-fi construct. Every If can be re-written as follows:

> if (cond = true) then
>   exptrue;
> else
>   expfalse;
> fi;

Examples:

> x := 5;
> If (mod(x, 2) = 0, x / 2, (x - 1) / 2);




Gaston Gonnet
1998-09-15