Kbase 12421: How conditional BOOLEAN expressions are evaluated : AND OR
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
How conditional BOOLEAN expressions are evaluated : AND OR
When PROGRESS examines a BOOLEAN expression, it begins by identifying
the first "test", based on the operators and parentheses punctuation.
If the first test, or condition, fails, PROGRESS does not evaluate
any other conditions of the expression. By identifying, as soon as
possible, the branch of logic that needs to be executed, PROGRESS aids
the performance of the expression.
The following code is an example.
IF exp1 AND exp2 THEN DO: {process.i} END.
If exp1 is FALSE, then PROGRESS does not evaluate exp2 at all. To see
this behavior, create an invalid exp2 , for example, a non-existant
subscript element of an array (exp2[0]). PROGRESS does not generate
an error because it skips the evaluation of the second expression.
PROGRESS examines OR conditions in the same way: If the first of two
or many conditions is TRUE, then PROGRESS does not evaluate any
remaining conditions. For example, in the following line of code,
if exp1 is true, PROGRESS does not evaluate exp2.
IF exp1 OR exp2 THEN DO: {process.i} END.
PLEASE NOTE: The above information does not necessarily apply to
boolean expressions used in the WHERE clause of a FIND or FOR EACH
statement. As of Progress Version 8.0, both conditions of AND and OR
expressions in WHERE clauses are evaluated.
Progress Software Technical Support Note # 12421