Relational Operators
The conditions within an If construct are logical expressions which evaluate to true or false. Conditions are built using relational operators.
Relational Operators
Operator | Operation | Examples of true conditions |
---|---|---|
= | Equals | if (2 = 2) { write "equal" } |
> | Greater than | if (4 > 3) { write "greater than" } |
< | Less than | if (3 < 4) { write "less than" } |
>= | Greater than or equal | if (4 >= 3) { write "greater than or equal" } |
<= | Less than or equal | if (3 <= 3) { write "less than or equal" } |