Why to use empty parentheses in Scala if we can just use no parentheses to define a function which does not need any arguments?

Viewed 10299

As far as I understand, in Scala we can define a function with no parameters either by using empty parentheses after its name, or no parentheses at all, and these two definitions are not synonyms. What is the purpose of distinguishing these 2 syntaxes and when should I better use one instead of another?

4 Answers
Related