View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Does VBA shortcut "or" statements?

I kind of suspected that was what the OP meant but didn't want to second
guess a reply.

Although logically it might seem as though evaluating the right operand is
redundant if the left is true, I assume it always evaluates both as Or works
by doing a Bitwise comparison of the pair.

v = -1 Or -1
v = -1 Or True
v = True Or 0
the above all return -1 but the following returns True.
v = True Or True

Regards,
Peter T

"Chip Pearson" wrote in message
...
Explain the question


Shortcutting in this context means that, for example, the right operand of
an OR operation is not evaluated if the left operand is True. Logically,
shortcutting makes sense, because if the left operand is True, there is no
need to evaluate the right operand since the OR is True regardless of the
value of the right operand.

No, VB/VBA does not shortcut operations.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"Peter T" <peter_t@discussions wrote in message
...
Explain the question

Regards,
Peter T

wrote in message

...
Thanks.

***