9.1 Conditional statements

  ---------------------------

 

      Conditional statements used for branching are the same as in C.

 

      C-- has two branching statements, 'if' and 'IF'.

 

      'if' makes a near conditional jumps, while 'IF' makes a short (8-bit)

  conditional jump. 'IF' is faster and can save up to 3 bytes of code, but

  can do jumps only in 127 bytes of code.

 

      Conditional statements, as in C, can be accompanied by a single command

  or a block of several commands found in braces { }. Conditional statements

  have the same restrictions as conditional expressions.

 

      If an 'IF' statment is followed by more than 127 bytes of code, the

  translator produces the following error message:

 

      This may be corrected by simply replacing 'IF' with 'if'.

 

      The commands 'else' and 'ELSE' are used as in C, except that 'ELSE' has

  a jump address limit of 127 bytes, like 'IF'. 'else' generates code 1 byte

  longer than 'ELSE'.

 

      You can freely combine 'IF' and 'else' or 'if' and 'ELSE' as in the

  following example:

 

          if( x == 2 )

              WRITESTR("Two");

          ELSE{ WRITESTR("not two.");

                printmorestuff();

              }

 

      If 'ELSE' is followed by more than 127 bytes of code the following

  error message will be generated:

 

          ELSE jump distance too far, use else.

 

      This can be corrected by simply replacing 'ELSE' with 'else'.