Logical expression evaluation

  • Thread starter Thread starter S.L.
  • Start date Start date
S

S.L.

I found that code like "If exp1 or exp2 then", exp1 and exp2 are both
evaluated reglardless of exp1 value is TRUE.

Is there option to disable exp2 evaluation if exp1 return TRUE ?

TIA
 
What about

IF exp1 THEN
ELSE if exp2 THEN
END IF
END IF

Pavel
 
You might try nesting your if statements. Example

if(exp1)then
if(exp2)then
endif
endif

Logically, the only reason to use your original expression
is if one or the other would cause you to want to take
some action. Example:

If (stoplight=red OR stoplight=yellow) then
Apply brakes
End If

If the Exp2 is important ONLY IF exp1 is True, nesting the
if expressions is the way to go. If both are important,
your original method is the way to go.

Hope that helps!

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top