Login  Register

Re: How does Boolean ifTrue work?

Posted by Esteban A. Maringolo on Oct 31, 2016; 3:08pm
URL: https://forum.world.st/How-does-Boolean-ifTrue-work-tp4920873p4920903.html

2016-10-31 12:11 GMT-03:00 Norbert Hartl <[hidden email]>:
>
> Am 31.10.2016 um 15:59 schrieb [hidden email]:
>
> but you should use myCollection ifEmpty: [ ... ]
>
> Why?

It enables you to implement polymorphism with an object that might not
be aCollection, but behaves like one.
Of course you could also implement #isEmpty, but in my experience the
less you test (#isEmpty) and the more you delegate (ifEmpty:) the
better. :)

Regards,

Esteban A. Maringolo