Sunday 8 November 2015

Implicit and explicit returns from methods

A Smalltalk method will return the receiver, by default.

So, if you want it to return any other value, you must say so explicitly.

e.g.
isSomething
self  booleanStateCheck

returns self

isSomething
^ self booleanStateCheck

returns aBoolean (in this case)

No comments:

Post a Comment