Inserted work around for 'fallthrough' only being allowed as the last non-empty statement of a 'case' or 'default' clause

alanfo 2015-10-19 10:13:00 +01:00
parent 77163493bc
commit eda917fd38

@ -134,7 +134,22 @@ default:
error()
}
```
However, you can work around this by using a 'labeled' `fallthrough`:
```
switch {
case f():
if g() {
goto nextCase // Works now!
}
h()
break
nextCase:
fallthrough
default:
error()
}
```
## Multiple cases
If you want to use multiple values in the same case, use a comma-separated list.