Skip to content

Latest commit

 

History

History

18-switch

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Lesson 18: switch statement

Multi-way branch on a single value.

What you'll learn

  • matches with ===
  • break prevents fall-through
  • intentional fall-through groups cases
  • default handles the rest

Example

See examples/.

Exercise

Convert an if/else chain of 4 branches into a switch.