Hello, I need to know how the “or” operator works? Does it check all the conditions whether they are true or false even if it finds the true condition or Does it skip the rest of the condition statements when it finds the first true condition.
Thanks.
local numbervar array test;
redim test[1];
test[1] := 2;
local numbervar i := 100;
[b]if (i = 100) or (test[i] > 0) then[/b]
"Yes"
else
"No";
That formula returns "Yes" when I run it.
The one below gives an "subscript out of range" error:
Code:
local numbervar array test;
redim test[1];
test[1] := 2;
local numbervar i := 100;
[b]if (test[i] > 0) or (i = 100) then[/b]
"Yes"
else
"No";
So the answer to your question is that Crystal Reports uses short-circuit evaluation. It does not check all conditions in an OR statement. As soon as the first condition is true, the whole statement is said to be true and all other conditions are ignored.
JC
_________________________________________________ To get the best response to a question, read faq222-2244.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.