switch & Fallthrough Playground

The neighbourhood head delivers a letter through the switch house: which room plate matches, and where does he walk once he is in that room? Put a break in or…

Why it matters

Accidental fallthrough is a classic bug: one case’s logic leaks into the case below. Add the === matching that often surprises (values from an input are always text). Knowing when fallthrough is meant and when an object lookup is better keeps your control flow clean.

The key idea

switch keeps going until it meets a break

Common mistakes

Try it in this playground