My preferred way is the following:

Add the following method to Object (or somewhere else):

Object>>escaper: aBlock
   ^ aBlock value: [ ^ nil ]

Then implement your loop like this:

self escaper: [ :break |
   1 to: 10 do: [ :x |
      x = 3 ifTrue: [ break value ].
      ... ] ]

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to