And vs AndAlso

Mehyar

Well-known member
Joined
Jun 9, 2003
Messages
371
Location
Lebanon
Ok so I know AndAlso is better than And becasue if the first operand is false, it doenot compute the second, and the same applies to OrElse, the question I have is Are And and Or operators left for backward compatibility ? becasue I still cant see any use of them in the presence of AndAlso and OrElse ??
 
You may have code that requires both operands to be evaluated - perhaps you are comparing the result of two functions - but both of those functions have required side-effects. Not good design in my opinion but it does happen from time to time.
 
Plus the And and Or operators and bitwise operators. You use Or with Enumerations for choosing multiple flags and use And to figure out which flags are selected.
 
Back
Top