Sunday, October 9, 2011

What is difference between OR (|) and Logical OR (||) ?

1. Logical OR Sign is || and AND Sign is  |.
2. Both work is same but Operation Method is Different 
for example 
if(a==10 || b==10) 
here if a =10 then condition is Satisfied and not going checking values of B. 
Moral One Operation for checking second i.e B values decrasesand in AND & operation 
if(a==10 | b==10)
here if a ==10 then also it is checking B value i.e  it is not necessary.    
    
Logical OR(||) is Best.    

What is difference between AND & and Logical AND &&?

1. Logical AND Sign is && and AND Sign is  &.
2. Both work is same but Operation Method is Different
for example
if(a==10 && b==10)
here if a =10 then only it going for  checking b value
if a !=10 then condition is not satisfied.
Moral One Operation for checking second values decrases
and in AND & operation
if(a==10 & b==10)
here if a !=10 then also it is checking B value it is not necessary.
Logical AND(&&) is Best.    
ASPdotNET-Example