Hi,
I just share a basic concept for the begginer to understand that the difference between And and AndAlso , Or and OrElse.
AndAlso - Operator
This is used to connect two (or more) logical conditions checking like if (condition1 AndAlso condition2).
If the first condition is false, It won’t perform the second condition .
So our execution time is saving in a logical operation in which more conditions are combined using “AndAlso" operator.
And - Operator
This is used to connect two (or more) logical conditions checking like if (condition1 And condition2).
It will perform both condition. Even first condition is false .
So our execution time is losing .
OrElse - Operator
This is used to connect two (or more) logical conditions checking like if (condition1 OrElse condition2).
If the first condition is true, It won’t perform the second condition.
So our execution time is saving in a logical operation in which more conditions are combined using “OrElse" operator.
Or - Operator
This is used to connect two (or more) logical conditions checking like if (condition1 Or condition2).
It will perform the both condition first and second. Even the first is true.
So our execution time is losing.
Thank you for the information. I have a question, what is the use of And, Or operators? As we learned from other languages I see AndAlso, OrElse seems useful but I am unable to get the reason for the other two operators when there is no use in evaluating the second condition when already confirmed the result.
Yes, that’s correct but my point was when we could able to conclude that the condition was already True (In OR) or False (In AND) by checking the 1st condition itself then what is the point in going to the 2nd condition.