Consultor Eletrônico



Kbase P29052: How conditional BOOLEAN expressions are evaluated : AND OR
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   02/07/2003
Status: Unverified

GOAL:

How conditional BOOLEAN expressions are evaluated : AND OR

FIX:

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-existent 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.