4.5 Conditional expressions

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

 

      Conditional expressions are expressions which when calculated give the

  result 'TRUE' or 'FALSE',  and are used in 'if' statements and in 'do {}

  while', 'while' and 'for' loops.

 

      There are two types of conditional expressions, simple and complex.

 

      Conditions may be logically combined.

 

 

    4.5.1 Simple conditional expressions

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

        Simple conditional expressions are a single lexeme or expression

    which takes on the value 'TRUE' if the calculated value is different from

    zero or 'FALSE' if it is equal to zero.

 

 

    4.5.2 Complex conditional expressions

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

        Complex conditional expressions are of the following form:

 

         (left_part operator_relation right_part)

 

    Where:

 

       left_part is any expression of type AL/AX/EAX or constant expression.

    The type of expression is determined by the type of the first lexeme

    (a register or variable); the default type is 'word' for 16-bit programs

    and 'dword' for 32-bit programs. If a different type is desired, precede

    the relevant expression with a keyword defining its type: byte, char,

    int, long, dword or float.

 

       operator_relation - any one of operators a relations:

                           ==, !=, <>, <, >, <=, or >=.

 

       right_part - any single register, single variable or constant

                 expression.

 

        Examples of valid complex conditional expressions:

 

         (X + y > z)

         (int CX*DX < = 12*3)

         (byte first*second+hold == cnumber)

 

        Examples of invalid complex conditional expressions

 

         (x+y >= x-y) // the right part is not a single lexeme or

                         constant expression.

 

         (Z = y) //  improper use of = instead of ==