9. Control Statements
Control statements allow us to control the flow of our programming and cause different things to happen, depending on the values of tests. Tests result in a
FALSE, which is used in if-like statements. The main control statements are if, else, ifelse and switch.
The most common test is the if command. It essentially says. If something is
TRUE, then perform some action; otherwise, do not perform that action. The thing we are testing goes inside parentheses following the if command. The most basic checks are: equal to (
==), less than (
<), less than or equal to (
<=), greater than (
>), greater than or equal to (
>=) and not equal (
If these tests pass they result in
TRUE, and if they fail ...