[Newbies] next or break in a loop

Joseph Alotta joseph.alotta at gmail.com
Mon May 9 17:51:16 UTC 2016


Greetings,

I am in need of a way to go to the end of a do loop.

myCollection do:  [ :item |

                (blah blah) ifTrue: “we found an item of the first type”
                 next item.

                (blah blah) ifTrue: “we found an item of the second type”
                 next item.
 
                (blah blah) ifTrue: “we found an item of the third type”
                next item.
  
                (blah blah) ifTrue: “we found an item of the fourth type”
                next item.

                (blah blah) ifTrue: “we found an item of the fifth type”

].


Some other languages have “break” or “next” or “goto LABEL” to skip the processing of the rest of the loop in case the item is found in the first test.

How do I implement this in Squeak?

Sincerely,

Joe.


PS.  This is not a homework project.





More information about the Beginners mailing list