Cursed fallthrough pattern

I think @Drew_Crawford1 has a point. The sentence referred to:

The fallthrough keyword simply causes code execution to move directly to the statements inside the next case (or default case) block, as in C’s standard switch statement behavior.

is nonsensical, because there is no C statement to be "as in" Swift. There is only as-ness when the fallthrough happens to be at the end of its case, which is a special … um … case. In addition, C's standard behavior isn't well described as "move to". It just falls through**. (Similarly, we'd never say that an assignment "moves directly to" the next sequential statement when it's done. It's not false to say so, just more confusing to say than not.)

The documentation note would be better without that last clause referring to C. The actual behavior is much better described in the main body of text in the preceding paragraphs.

** So, paradoxically, Swift's fallthrough is named after C's behavior, but doesn't actually have C's behavior.

1 Like