I've seen some samples of scala code where multiple lines of code are used as a block of code with no curly braces, for instance:
x match {
case a:Int =>
val b = 1
val c = b +3
println("hello!")
c
case _ => 5
}
same with some very long functions that use an implicit param of the form:
a.map { implicit x =>
// many, many complex lines of code
}
as opposed to:
a.map { implicit x => {
// many, many complex lines of code
}}
I've seen a lot of documentation/FAQ stating that multiple lines of code should be surrounded always by curly braces, but could not find an explanation for these exceptions. I would love to understand or have a good intuition so that does not feel like magic to me.