[Newbies] How to empty a collection?
Ron at USMedRec.com
Tue Feb 19 01:02:07 UTC 2008
aCollection copy do: [:anElement |
aCollection remove: anElement
Why copy? If you start removing items from the collection, increasing the
index will cause you to skip elements.
> -----Original Message-----
> From: itsme213
> I want to clear its contents (size goes back to zero), and can't seem to
> find something like #clear or #empty. Cannot use a new collection as there
> are shared references to it.
> Thanks - Sophie
More information about the Beginners