What is the formal difference in Scala between braces and parentheses, and when should they be used?

后端 未结 9 1143
萌比男神i
萌比男神i 2020-11-22 07:09

What is the formal difference between passing arguments to functions in parentheses () and in braces {}?

The feeling I got from the Pro

9条回答
  •  难免孤独
    2020-11-22 08:01

    Parenthesis in an ideal coding style is basically used for single line code. But if the particular piece of code is multiline then using braces is a better way.

提交回复
热议问题