[Pharo-project] smalltalk: breaking out of a loop..

Göran Krampe goran at krampe.se
Sun Nov 7 21:50:24 CET 2010


On 11/07/2010 08:06 PM, Guillermo Polito wrote:
> #anySatisfy: does not iterate over the entire collection either.  So if
> you only want to know if there is one that satisfies the condition...
> this is the message you're looking for.
>
> Cheers!
> Guille

And finally, a generic "trick" for breaking out of loops (not just 
iterations over collections):

Factor out the loop in a single method, then call it. When you want to 
break out, just do a normal return!

regards, Göran




More information about the Pharo-project mailing list