a newbie question (disregard earlier message)
Bob Arning
arning at charm.net
Thu Jan 10 01:49:37 UTC 2002
Hari,
The only problem I see is that you omitted the colon after 'to'...
1 to self size
should be
1 to: self size
Otherwise it works fine. If not, tell us what _is_ happening.
Cheers,
Bob
On Wed, 9 Jan 2002 17:47:46 -0500 Hari Balaraman <hbalaram2 at yahoo.fr> wrote:
>I'm attempting to learn Smalltalk and would like to post a small
>question. I apologise in advance if this is is not the appropriate forum
>for basic questions. Is so please point me in the direction of the
>relevant forum. Any assistance will be greatly appreciated.
>Thanks much,
>
>Hari
>
>what follows is the method I wrote for the following problem: write an
>array in which each element is the square of the corresponding element
>in the receiver array. I cannot find out what I am doing wrong:
>
>arraySquared
> |squarearray |
> squarearray := Array new: (self size).
> 1 to self size
> do: [:index | squarearray at: index put:((self at:
>index)*(self at: index))].
> ^ squarearray
More information about the Squeak-dev
mailing list
|