How to return array keys into another array

Ned Konz ned at squeakland.org
Fri Jun 11 14:36:40 UTC 2004


On Thursday 10 June 2004 4:03 pm, adrian voss wrote:
> Hi, thank you all for the advice.  Reason for using the indices is that in
> this instance they refer to the seat numbers in a fictitious reservation
> program for a course I am on.  The question asked for arrays to be used.
>
> I really hope that there is an easier way to do this because this had me
> stumped.

How about a really naive approach:

^myArray keys select: [ :i | (myArray at: i) = 'free' ]

-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list