[Newbies] Adding method to Smallinteger class
david.mitchell at gmail.com
Sat Apr 24 12:26:36 UTC 2010
OK, Bert is having a little fun. Certainly good to learn that self is the
But I wouldn't think of this as idiomatic smalltalk style.
I would prefer to follow "Interesting Return Value" [Beck]. I also factored
out the return, since that is the same in both branches.
^ self > anInteger
On Fri, Apr 23, 2010 at 4:39 PM, Bert Freudenberg <bert at freudenbergs.de>wrote:
> On 23.04.2010, at 23:19, Herbert König wrote:
> > Hi Randal,
> > RLS> larger: anInteger
> > RLS> ^self max: anInteger
> > RLS> Code re-use, bay-bee.
> > true but couldn't resist to throw blocks at a newbie myself :-))
> Sure, but two blocks are just too scary ;)
> Much more fun to figure out why this works:
> larger: anInteger
> anInteger > self ifTrue: [^ anInteger]
> - Bert -
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners