Semicolons are expression delimiters and they are inferred. Scala treats the end of a line as the end of an expression, except when it can infer that the expression continues to the next line, as in this example:
// src/main/scala/progscala2/typelessdomore/semicolon-example.sc
// Trailing equals sign indicates more code on the next line.
def equalsign(s: String) =
println("equalsign: " + s)
// Trailing opening curly brace indicates more code on the next line.
def equalsign2(s: String) = {
println("equalsign2: " + s)
}
// Trailing commas, periods, and operators indicate more code on the next line.
def commas(s1: String,
s2: String) = Console.
println("comma: " + s1 +
", " + s2)
Ref