- If you want to create a one-dimensional array,
then instantiate the following pattern:
Array new: number of elements
- If you have an array,
and you want to store an expression's value in the array,
then instantiate the following pattern:
array name at: index put: expression
- If you have values stored in an array,
and you want to retrieve one of those values,
then instantiate the following pattern:
array name at: index
- If you want to iterate over the elements in an array,
then instantiate one of the following patterns:
array name do: [:element | ... element ...]
1 to: array name size
do: [:index | ... (array name at: index) ...]
- If you want to iterate over the elements in an array, and you want to
include the results of a previous iteration in each computation,
then instantiate the following pattern:
an Array instance
inject: initial value
into: [:previousResult :nextElement | statements]
- If you want to create a two-dimensional array, then create an array in
which the elements are themselves arrays.