OK, Bert is having a little fun. Certainly good to learn that self is the default value.<br><br>But I wouldn't think of this as idiomatic smalltalk style.<br><br>I would prefer to follow "Interesting Return Value" [Beck]. I also factored out the return, since that is the same in both branches.<br>
<br>larger: anInteger<br>
^ self > anInteger<br> ifTrue: [self]<br> ifFalse: [anInteger]<br>
<font color="#888888"><br></font><br><br><div class="gmail_quote">On Fri, Apr 23, 2010 at 4:39 PM, Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On 23.04.2010, at 23:19, Herbert König wrote:<br>
><br>
> Hi Randal,<br>
><br>
><br>
> RLS> larger: anInteger<br>
> RLS> ^self max: anInteger<br>
> RLS> Code re-use, bay-bee.<br>
><br>
> true but couldn't resist to throw blocks at a newbie myself :-))<br>
<br>
</div>Sure, but two blocks are just too scary ;)<br>
Much more fun to figure out why this works:<br>
<br>
larger: anInteger<br>
anInteger > self ifTrue: [^ anInteger]<br>
<font color="#888888"><br>
- Bert -<br>
</font><div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br>