You are on page 1of 1

Chapter 4

4.1
Relational Operators

Comparisons
o > greater than
o < less than
o >= greater than or equal to
o <= less than or equal to
o == Equal to
o != not equal
Boolean expressions true or false
Ex:
o 12 > 5 is true
o 7 <= 5 is false
o If x is 10 then,
X == 10 is trues
X != 8 is true
X <= 8 is false
Can be assigned to a variable:
o result = x <=y;
Assigns 0 for false, 1 for true
o Result = 1
Do not confuse = and ==
Relational operators are higher than regular operators

4.4
The If/Else statement
Ex:
If (expression)
Statement
Else (expression)
Statement
If = true
Else = false

You might also like