In the current Swift, absent `fallthrough`, the statement execution ends and no other statements are evaluated after the first match.
With `fallthrough` the current clause executes and the next clause executes, and then the statement execution ends.
With `continue`, the current clause executes and the switch continues searching for a matching pattern as if a pattern has not yet been matched.
-- E
···
On Jul 10, 2016, at 8:37 PM, Xiaodi Wu <xiaodi.wu@gmail.com> wrote:
This is a neat idea, and I think a very sensible way to extend the language. I worry only a little about the following:
Currently, unless preceded immediately by the keyword `fallthrough`, a condition implicitly excludes all previous conditions. That is, if I write `switch .. { case a: ...; case b: ...; case c: ... }`, my condition `c` is really `!a && !b && c`. With more flexible control flow within a switch statement, reasoning about what cases are matched by any particular condition after the first becomes increasingly difficult.