Method invocation

It is optional to use parentheses on method invocations. So

assertEquals 31, getDaysOnMonth(january)

assertEquals(31, getDaysOnMonth(january))

are equivalent. But there are constraints, it is not possible to omit parenthesis on nested calls. On the example above this will be wrong:
assertEquals 31, getDaysOnMonth january // this won't compile!

Meta Object Protocol

TODO read this:

Optional return statement

Methods and Closures return a value either as an explicit 'return' statement, or as the value of the last statement in their body.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License