﻿ Logical Expressions

logical Expressions ☆☆☆

Comparison operators
A comparison operator is one of
`=` , `<> `, `<` , `> `, `<= `, `>=` .

Comparisons
A comparison is
numeric_expression conparison_operator numeric_expression
or
string_expression comparison_operator string_expression

Logical Expressions
A Logical expression is comparisons combined by AND, OR, or NOT.
NOT is written just before the comparison that is to be negated.
AND or OR is written between the two comparisons.
The priority is in order of NOT，AND，OR.
Note that AND has the higher priority than that of OR.
Parentheses can be used for changing priority.
Examples.
``` NOT( a=1 OR a=2 ) a=1 AND (b=0 OR c=0)```

Evaluation of logical operation
On the expression ' ` p AND q`', p is evaluated first and if it is false then q shall not be evaluated.
Similarly, on the expression' ` p OR q`', p is evaluated first and if it is true then q shall not be evaluated.

Example.
When the upper bound of an array x is 10 and the value of a variable i is 11, the evaluation of an expression
` i<=10 AND x(i)=0 `
does not cause an exception.