a newbie question
Hari Balarmaan
hbalaram at yahoo.com
Wed Jan 9 22:43:28 UTC 2002
Hi all,
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.
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
|