diff --git a/docs/bugpattern/TraditionalSwitchExpression.md b/docs/bugpattern/TraditionalSwitchExpression.md new file mode 100644 index 00000000000..696272f3ba0 --- /dev/null +++ b/docs/bugpattern/TraditionalSwitchExpression.md @@ -0,0 +1,6 @@ +The newer arrow (`->`) syntax for switches is preferred to the older colon (`:`) +syntax. The main reason for continuing to use the colon syntax in switch +*statements* is that it allows fall-through from one statement group to the +next. But in a switch *expression*, fall-through would only be useful if the +code that falls through has side effects. Burying side effects inside a switch +expression makes code hard to understand.