-1

I found using AndAlso/OrElse, all the time, VERY annoying. It reduces code readability, especially when conditioning get complicated.

Any suggestions?

Bohoo
  • 1,099
  • 11
  • 25
  • 1
    It's helpful to restate the question in the actual *question*, rather than just asking the question in the title, and then going sort of randomly off topic in the question itself. – Tyler Jun 20 '10 at 05:47
  • That'd be [Yabba Dabba Doo](http://en.wikipedia.org/wiki/The_Flintstones) , not Yaba Yaba Du. At least get the **facts** right. – Kobi Jun 20 '10 at 06:01
  • 1
    Another sensible path would be to use the non-short-circuiting versions `And` & `Or` most of the time, when it doesn't actually matter whether the logic short-circuits. That adds some self-documentation, because the occasional use of `AndAlso` & `OrElse` will stand out and emphasise that you are relying on the short-circuiting. – MarkJ Jun 21 '10 at 16:33

1 Answers1

4

I'm fairly sure there's no (supported) way to change the meaning of And/Or, and assuming that your code might in the future be maintained or read by other people it would be a very bad idea, you'd confuse them completely.

If conditioning gets too complicated I'd suggest instead splitting it up on multiple lines.
so instead of:

If x AndAlso y AndAlso (z Or w) Then

Make it something like:

xy = x AndAlso y
zw = z Or w
if xy AndAlso zw Then
Hans Olsson
  • 54,199
  • 15
  • 94
  • 116