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 else block 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!

Please set the playground first

Loading "Conditionals"
Loading "Conditionals"