Questions tagged [switch-statement]

59 questions
19
votes
2 answers

Why don't languages use explicit fall-through on switch statements?

I was reading Why do we have to use break in switch?, and it led me to wonder why implicit fall-through is allowed in some languages (such as PHP and JavaScript), while there is no support (AFAIK) for explicit fall-through. It's not like a new…
zzzzBov
  • 5,824
  • 1
  • 28
  • 28
15
votes
7 answers

Appropriate uses of fall-through switch statements

When is it appropriate to use a fall-through (classic) switch statement? Is such usage recommended and encouraged or should it be avoided at all costs?
shabunc
  • 2,414