Basically, if you have a simple if-then statement as follows:
If myInteger=4 And myString=“Hello” then
CallFunction()
End If
then your program will check both myInteger
AND myString
to see if they match the required values, and then proceed. If you change And
to AndAlso
, your program will first evaluate myInteger
. If it does indeed equal 4, THEN the code will look to myString
to check whether or not it contains “hello”, before it considers running CallFunction()
. If myInteger
is not 4, the if-then block is exited, without ever checking in with myString
.
OrElse short-circuits Or
statements in the same manner.
It's a simple shortcut that is quickly applied across a large application, which makes your code ever so slightly more efficient.
For more info, check out Mike Farnsworth's article on it.