VB.NET Compiler

Y

yhlove

Hi

as much as I know from univsersity compilers dowsn't check another
statements after they find a TRUE statement.
example:

a=1
b=2
if a=1 or b=3 then
.....
end if

Because a=1 statement is TRUE, the compiler shouldn't check the
statement b=3 (because there's "OR" between them)

I can't understand why the VB.NET (VS 2003) insist to check all the
statements.....????!?
How Can I change it ?

Thanks
Yhlove
 
G

Guest

You want to use "Short-Circuiting" logic. Use OrElse instead of Or and
AndAlso instead of And.

PJ Simon
 
S

stax

Who needs and/or anyway? It's pretty lame having to type AndAlso and OrElse all day long but that's VB .NET

AndAlso -> lame
&& -> lame
and -> good, Boo and IronPython got this right I think
 
R

RobinS

AndAlso did not exist in VB6. When MS developed VB.Net, they added AndAlso
and OrElse rather than changing And and Or because there are cases where
you still want to use And and Or. They also didn't change it because it
would have made it a lot more difficult for people to convert their VB6
projects to VB.Net. They would have to check every single And and Or in a
project if all of them got converted to AndAlso and OrElse logic.

Robin S.
--------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top