[program-l] Re: VB.NET AndAlso vs And

  • From: "tyler" <compgeek13@xxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Mon, 28 Mar 2005 06:34:06 -0700

*pout* I am getting way better, and have used the online documentation a lot.
Ty Littlefield
email:
compgeek13@xxxxxxx
----- Original Message ----- From: "David Lant" <david.lant1@xxxxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Monday, March 28, 2005 6:32 AM
Subject: [program-l] VB.NET AndAlso vs And



Hi all,

I was reading through an interesting article on MSDN about semi-connected
applications using VB.NET, and came across the AndAlso logical operator.  As
I'd not noticed it before, I looked it up in the online help.  (Tyler, take
note.)

I fully understand that using the AndAlso operator shortcuts the evaluation
of each expression, so that if any of the component expressions evaluate to
False, then the remaining expressions are not evaluated.  The problem is, I
can't for the life of me understand why one would *not* want to shortcut
such logical evaluations.

I do appreciate that the And operator has an additional function of
performing bitwise And operation on expressions.  But I'm left thinking that
what this really means is that under VB.NET, we should always use AndAlso
for logical conjunctions on expressions, and only use And for bitwise
comparisons.

Is this right?  Or am I leaping to an unfounded conclusion?  If anyone can
offer a reason why you would want to evaluate something that wouldn't affect
the result, I would very much appreciate it. <smile>

All the best,

David


** To leave the list, click on the immediately-following link:- ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe] ** If this link doesn't work then send a message to: ** program-l-request@xxxxxxxxxxxxx ** and in the Subject line type ** unsubscribe ** For other list commands such as vacation mode, click on the ** immediately-following link:- ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq] ** or send a message, to ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: