Last updated at 5:26 am UTC on 26 May 2007
I'm a (as of this week (May 24/2007) a brand spankin' new Squeak / Smalltalk / Seaside "programmer" ... er more like explorer at this point.
I've been "programming recreationlly" for about 20 years, with all kinds of languages, Basic, C, C++, Perl, and recently Python, Ruby.
Email me: mstramba at sympatico dot ca
- (1 2 3 4 5) do: [ :each | Transcript cr; show: each printString].
The method reverseDo: iterates over the collection in reverse.
If you send do: to a Dictionary, it iterates through the values in the Dictionary. Three other methods,
keysDo: , associationsDo: , and keysAndValuesDo: iterate over the keys, the associations, and the
key and value pairs.
Another message, with:do: , allows you to iterate over two parallel collections, passing corresponding
elements from the two collections to the do: block.
The collect: message allows you to do something for each item in the collection and puts the result of
your action in a new collection. For example, if you wanted to create a new collection of the squares of a
collection of numbers you could do either of the following.
Enumerating Nested Dictionaries