< Previous | Contents | Next >

Using Logical Operators

So far youve seen pretty simple expressions evaluated for their truth or falsity. However, you can combine simpler expressions with logical operators to create more complex expressions. Table 2.2 lists the logical operators.


Table 2.2


Logical Operators


Operator

Description

Sample Expression

!

Logical NOT

!expression

&&

Logical AND

expression1 && expression2

||

Logical OR

expression1 || expression2


 

Introducing the Designers Network ProgramUsing the Logical AND OperatorUsing the Logical OR OperatorUsing the Logical NOT OperatorUnderstanding Order of Operations