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

RedTigerFish chihuyu at gmail.com
Fri Nov 17 06:00:26 UTC 2017


*1 to: 130 do: [:i| ] *  or  *100 timesRepeat: [ ] *

Maybe because I learned some C before. I thought the above two are loops.


The following is "break" example in C. How to implement that in Smalltalk? 

#include <stdio.h>
void main() 
{   
     for (int i = 0; i < 100; i++) 
         if (i == 50) 
              break; 
}



-----
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


More information about the Beginners mailing list