Iterator Solutions
nCode unification
n“This is Smalltalk.”
narray do: [ :value | sum := sum + value ].
narray do: [ :value | product := product * value ].
narray do: [ :value | Transcript nextPutAll: value printString ].
narray do: [ :value | stream nextPutAll: value printString ].
n
n// This is C#
nforeach (int value in array)
n    max=max<value ? value : max;
nforeach (int value in array)
n    min=value<min ? value : min;
Internal iterators can be used to remove the duplicated traversal code.  We’ll distinguish internal and external iterators shortly.