You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A suggestion about methods that take no parameters
When a method takes no parameters, it’s said to have an arity level of arity-0. Similarly, when a method takes one parameter it’s an arity-1 method. When you create arity-0 methods:
If the method performs side effects, such as calling println, declare the method with empty parentheses
If the method does not perform side effects—such as getting the size of a collection, which is similar to accessing a field on the collection—leave the parentheses off
For example, this method performs a side effect, so it’s declared with empty parentheses:
def speak() = println("hi")
The text was updated successfully, but these errors were encountered:
Function from https://docs.scala-lang.org/scala3/book/taste-hello-world.html
is arity-0 and performs side effects, therefore it should look like this:
https://docs.scala-lang.org/scala3/book/methods-most.html says:
The text was updated successfully, but these errors were encountered: