tags:

views:

56

answers:

2

Does VB6 short circuit conditional tests? That is to say, can I be sure a statement like...

If index <= array_size And array(index) > something Then

will never burst the array, whatever the value of index might happen to be?

+9  A: 

No, VB6's And and Or don't short-circuit (which is the reason why the short-circuit versions are called AndAlso and OrElse in VB.net — backward compatibility).

KennyTM
I had no idea VB.NET supported this! Thanks so much for this enlightening answer. You have saved me many nested `if` statements.
Brad
Thank you, KennyTM. You have doubtless saved me many exploding arrays.
Brian Hooper
+1  A: 

Select Case is a short circuit method if you can use it for your purpose.

Cidtek
I don't think I can, but thank you for the suggestion anyway.
Brian Hooper