A method in programming language is a bit of code that get executed when called and return a value.
In Scala, the boundary between Values and Methods is very thin and we are going to learn more about all of it as we go into more complex Scala Knowledge Bits.
But, if things goes as planned, today should be simple.
I hope you had fun with today’s Scala Knowledge Bit !
One main thing to note, if the method do not take arguments, you do not need the
(...), the parentheses are optional.
In practice, you have to be careful when calling the method. Be sure to use parentheses when it was defined with them. And don’t use the parentheses when the method was defined without them.