next up previous contents index
Next: Binding Local Variables (let) Up: Functions and Constructs Previous: Functions and Constructs

Conditionals (if)

The only primitive conditional in NESL is the if construct. The syntax is:

tabular4278

If the first expression is true, then the second expression is evaluated and its result is returned, otherwise the third expression is evaluated and its result is returned. The first expression must be of type bool, and the other two expressions must be of identical types. For example:

is a valid expression, but is not, since the two branches return different types.



Jonathan Hardwick
Tue Nov 28 13:57:00 EST 1995