How to use Logical Operators

 

Definitions

Operator

Definition

||

Logical OR

&&

Logical AND

 

Example

The Value of A||B

 

A is true

A is false

B is true

1

1

B is false

1

0

 

The Value of A&&B

 

A is true

A is false

B is true

1

0

B is false

0

0

 

     If A or B is true, the value is not expressed as 0.

     If A or B is false, the value is expressed as 0.