Smalltalk in small steps
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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment