Hello,
I am curious to learn if VBS has any support for short-circuit operators, as in some higher level languages? The VBS reference is silent on this point. For example, the expression:

if (A and B) or (C and D) then
...
end if

can be 'short-circuit' to the then portion if A is true -- *WITHOUT* evaluating B, C, or D. This can come in very handy if verifying something is in range of an array index *BEFORE* evaluating B, C, or D which may depend upon a valid index variable. You can also see that if this expression must be split apart into their own if statements, the code can become very complicated, duplicated, and error prone in a hurry. If I have to break it apart, I think I'd opt for boolean functions (more than one would be needed) to use in the expression. but, shortCircuit operators are a lot more convenient.

Thanks!

David Helkenn

Reply via email to