You can watch the video below or click here to view it on YouTube. Make sure you also have a look at the sample code further below and feel free to use and modify it.
So after watching the video, let’s recap what logical operators are all about. Using logical operators such as and/or allow a programmer to write complex if statements. For example, you can check if a number is greater than 10 AND is also less than 20 (both conditions have to evaluate to true for the code to run inside the if statement). Or, you can check if a number is less than 5 OR greater than 10 (only one condition has to evaluate to true for the code to run inside the if statement)
- A single exclamation mark ! can also be used as a not operator.
Next tutorial: Switch statements