Home Segments Index Top Previous Next

421: Mainline

You can iterate over the elements in a Bag instance by using a do: message exactly like the do: message used with arrays or ordered collections:

Workspace
(Bag new add: 570; add: 720; add: 640; add: 720; yourself) 
  do: 
  [:element | Transcript show: element printString; space] 
Transcript 
570 640 720 720