To brace or not to brace: case statement block
coding-style, scala
Solution
The Scala's style guide about this http://docs.scala-lang.org/style/control-structures.html#curly-braces seems changed, where it says
case - Always omit braces in case clauses.
Actually, when editing in IntelliJ, it will remind user of unnecessary braces around case block.
Thus, to avoid introducing further confusion to users, please make a correction to the accepted answer :)
Problem
I am asking a specific question here (not an opinion): is there any scala style guide recommendation for the following "case o:" addressing whether the (optional) use of braces were to be avoided or if either with/without were both acceptable: ``` def mycase(x : Int) = { x match { case 0 => println("zero") println("blah zero") case 1 => println("one") } ``` I was not initially convinced it would even work (thought it might do a fall through): but it does the correct breakout: ``` scala> mycase(0) zero blah zero ``` I specifically want to know if there were a canonical answer on this (not "I prefer" , etc.). E.g. for java, Sun had stated long ago that placing the initial curly brace for a method may happen either on same or next line - both are acceptable. is there such a clear answer in this case? UPDATE An answer provided below by @acjay provides a link to the style guide. Inside here is a specific blurb. from http://docs.scala-lang.org/style/control-structures.html#curlybraces case - Omit braces if the case expression fits on a single line. Otherwise, use curly braces for clarity (even though they are not required by the parser).