Scala has functions in addition to methods. A method operates on an object, but a function doesn’t. C++ has functions as well, but in Java, you have to imitate them with static methods.
To define a function, you specify the function’s name, parameters, and body like this:
You are currently reading a PREVIEW of this book.
Get instant access to over
$1 million worth of books and videos.