modula-2 home

  Win32 API  


IF Statements

   IfStatement = IF expression THEN StatementSequence
      {ELSIF expression THEN StatementSequence}
      [ELSE StatementSequence] END.

The expressions following the symbols IF and ELSIF are of type BOOLEAN. They are evaluated in the sequence of their occurrence, until one yields the value TRUE. Then its associated statement sequence is executed. If an ELSE clause is present, its associated statement sequence is executed if and only if all Boolean expressions yielded the value FALSE.


   IF (ch>= "A") & (ch <= "Z") THEN ReadIdentifler
   ELSIF (ch > = "0") & (ch < = "9") THEN ReadNumber
   ELSIF ch = '"' THEN ReadString('"')
   ELSIF ch = "'" THEN ReadString("'")
   ELSE SpecialCharacter


  • Wirth N: Programming in Modula-2, 3rd ed. Springer Verlag, Berlin, 1985.