Prev Up Next
Go backward to Return Statements
Go up to Statements
Go forward to While Statements

If Statements

< if statement > -> if < expression > then < statement list >
< else part >
end ;
< else part > -> else < statement list >
|

JACCL does not recognize Boolean values as a separate type. Instead, it treats the integer value 0 as `false' and any non-zero value as `true'. Thus, to execute an if statement, the expression is first evaluated. If its value is non-zero, the statement list following the keyword then is executed after which execution resumes with the statement following the if statement. If the expression's value is zero and a non-empty else part was included, the statement list found in the else part is executed. If the else part is empty and the expression's value is zero, then control simply passes to the statement after the if statement.

Note that in JACCL, every if statement is bracketed by the keywords if and end. This eliminates the need to use separate begin - end brackets as in Pascal.


Computer Science 434
Department of Computer Science
Williams College

Prev Up Next