Conditionals
👨💼 Your code can now make decisions based on values!
🦉 Important notes about if/else:
- Conditions are checked in order - once one is true, the rest are skipped
- The
elseblock is optional - use it for a "fallback" case - You can nest if statements inside each other (but don't go too deep!)
The order of conditions matters! If we checked
score >= 70 first, a score of
95 would show "C" because 95 >= 70 is true. Always check the most specific
conditions first.Try changing the
score value and running the code again to see different
grades!