Lesson 4 of 4 · 9 minutes
Combining conditions: and / or
A decision can depend on more than one thing. Logical operators combine conditions.
&& means and: both conditions must be
true. || means or: at least one must be true.
For age >= 13 && age <= 19, 13 and 19 count. But
12 and 20 do not. Check the edge values carefully. That is where many
mistakes hide.
And means both. Or means either.
Loading the editor…
Test 13, 12, 19, and 20. Watch where the output changes.
Quick check
You can now combine conditions with and and or — and you know to watch the edges.