Re: Complex if statement.
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Wed, 31 May 2006 07:24:11 +0100
Mike Schilling <ap@xxxxxxxxxxxxxxxx> wrote:
"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:ufG4U2ChGHA.3956@xxxxxxxxxxxxxxxxxxxxxxx
Arne,
No, in C#, logical expressions short circuit themselves if it can not
effect the result.
To be precise, the operators && and || short-circuit. The operators & and
|, which can also be used in logical expressions [1], do not.
1. Note that this is different from C, C++, and Java, in which & and | are
bitwise operators only.
Not sure where you get that idea about Java from:
public class Test
{
public static void main(String[] args)
{
boolean a = true;
boolean b = false;
System.out.println (a&b);
}
}
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: Complex if statement.
- From: Mike Schilling
- Re: Complex if statement.
- References:
- Re: Complex if statement.
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Complex if statement.
- From: Mike Schilling
- Re: Complex if statement.
- Prev by Date: Create web based custom telnet client to communicate with remote destinations
- Next by Date: Re: Enums and IEquatable<T>
- Previous by thread: Re: Complex if statement.
- Next by thread: Re: Complex if statement.
- Index(es):
Relevant Pages
|