Value of a logical expression
| x1 | .NOT. x1 |
|---|---|
| True | False |
| False | True |
| x1 | x2 | .AND. | .OR. | .XOR. | .EQV. | .NEQV. |
|---|---|---|---|---|---|---|
| False | False | False | False | False | True | False |
| False | True | False | True | True | False | True |
| True | False | False | True | True | False | True |
| True | True | True | True | False | True | False |
A .LT. B .OR. LFCT(Z)
If A is less than B, the evaluation of the function reference is not required to determine that this expression is true.
XL Fortran evaluates a logical expression to a LOGICAL(n) or INTEGER(n) result, where n is the kind type parameter. The value of n depends on the kind parameter of each operand.
By default, for the unary logical operator .NOT., n will be the same as the kind type parameter of the operand. For example, if the operand is LOGICAL(2), the result will also be LOGICAL(2).
The following table shows the resultant type for unary operations:
| OPERAND | RESULT of Unary Operation |
|---|---|
| BYTE 1 | INTEGER(1) 1 |
| LOGICAL(1) | LOGICAL(1) |
| LOGICAL(2) | LOGICAL(2) |
| LOGICAL(4) | LOGICAL(4) |
| LOGICAL(8) | LOGICAL(8) |
| Typeless 1 | Default integer 1 |
- IBM extension
If the operands are of the same length, n will be that length.
For binary logical operations with operands that
have different kind type parameters, the kind type parameter of the
expression is the same as the larger length of the two operands. For
example, if one operand is LOGICAL(4) and
the other LOGICAL(2), the result will be LOGICAL(4). 
The following table shows the resultant type for binary operations:
| second operand | ||||||
|---|---|---|---|---|---|---|
| first |
*BYTE | LOGICAL(1) | LOGICAL(2) | LOGICAL(4) | LOGICAL(8) | *Typeless |
| *BYTE | *INTEGER(1) | *LOGICAL(1) | *LOGICAL(2) | *LOGICAL(4) | *LOGICAL(8) | *INTEGER(1) |
| LOGICAL(1) | LOGICAL(1) | LOGICAL(1) | LOGICAL(2) | LOGICAL(4) | LOGICAL(8) | LOGICAL(1) |
| LOGICAL(2) | LOGICAL(2) | LOGICAL(2) | LOGICAL(2) | LOGICAL(4) | LOGICAL(8) | LOGICAL(2) |
| LOGICAL(4) | LOGICAL(4) | LOGICAL(4) | LOGICAL(4) | LOGICAL(4) | LOGICAL(8) | LOGICAL(4) |
| LOGICAL(8) | LOGICAL(8) | LOGICAL(8) | LOGICAL(8) | LOGICAL(8) | LOGICAL(8) | LOGICAL(8) |
| *Typeless | *INTEGER(1) | *LOGICAL(1) | *LOGICAL(2) | *LOGICAL(4) | *LOGICAL(8) | *Default Integer |
If the expression result is to be treated as a default integer but the value cannot be represented within the value range for a default integer, the constant is promoted to a representable kind.


