Semicolons and infix operators

One issue with Scala’s semicolon convention is how to write expressions that span several lines. For instance
+ someOtherExpression
would be interpreted as two expressions:
+ someOtherExpression
To overcome this problem you could write the multi-line expression in parentheses, because semicolons are never inserted inside (...):
+ someOtherExpression)
Source: Coursera: Blocks and lexical scope

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
сніпети з Scala
Зареєструйся Зараз
або Підпишись на майбутні тести