Two ways of defining functions in Scala. What is the difference?
The def declares a method within a surrounding object/class/trait, similar to the way you define methods in Java. You can only use defs within other objects/classes/traits. In the REPL, you cannot see the surrounding object because it’s “hidden”, but it does exist. You cannot assign a def to a value, because the def is not … Read more