[Newbies] Does Smalltalk have "break" method to jump out of a loop ?

Benoit St-Jean bstjean at yahoo.com
Fri Nov 17 05:27:29 UTC 2017


It can be done like this with a return, for example

1 to: 10 do: [:each |  (each = 1) ifTrue: [^'Found it!'].
The caret makes you "exit"


----------------- 
Benoît St-Jean 
Yahoo! Messenger: bstjean 
Twitter: @BenLeChialeux 
Pinterest: benoitstjean 
Instagram: Chef_Benito
IRC: lamneth 
Blogue: endormitoire.wordpress.com 
"A standpoint is an intellectual horizon of radius zero".  (A. Einstein) 

    On Friday, November 17, 2017, 12:21:20 AM EST, RedTigerFish <chihuyu at gmail.com> wrote:  
 
 In C loop, there is break method which allows the program to jump out of the
loop when certain criteria has been met.

What is the counterpart in Smalltalk if there's one?



-----
Dig, dig where you are,
Down below's well.
Let those that walk in darkness shout, 
Down below's hell.
--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
Beginners at lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20171117/f2bef5b5/attachment.html>


More information about the Beginners mailing list