Recent Posts

Calendar

August 2012
S M T W T F S
« Jul   Sep »
 1234
567891011
12131415161718
19202122232425
262728293031  

Daily Archives: August 21, 2012

&& vs & and | vs ||… What’s the difference?

color-01 It seems like such a trivial thing to be talking about but not knowing the difference between the two operators can make a huge difference between working code and code that only seems to work.

Let me illustrate:

        bool b = false;
        bool c = true;
        if(b & c)
            // do something

        if(b && c)
            // do something