If Statement



next up previous contents index
Next: While Statement Up: Statements Previous: Signal Statement

If Statement

The form of the if statement is
if <expr> then <body> [elseif <expr> then <body>]* [else <body>] end
The expressions must be of type "bool". They are evaluated successively until one is found to be true. The body corresponding to the first true expression is executed, and the execution of the if statement then terminates. If none of the expressions is true, the body in the else clause is executed (if the else clause is present). The elseif form provides a convenient way to write a multiway branch.



theta-questions@lcs.mit.edu