Semicolons and infix operators

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

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
сниппеты с Scala
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты