<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>How to return array keys into another array</TITLE>
<META http-equiv=Content-Type content="text/html; charset=Windows-1252">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>
<DIV> input := Array with: 'free' with: 'reserved' with:
'free'.</DIV>
<DIV> output := OrderedCollection new.</DIV>
<DIV> input keysAndValuesDo:[:index :value|</DIV>
<DIV> value = 'free' ifTrue:[output add:
index].</DIV>
<DIV> ].</DIV>
<DIV> ^output</DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Cheers,</FONT></DIV>
<DIV><FONT size=2> - Andreas</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=r00tuk@yahoo.co.uk href="mailto:r00tuk@yahoo.co.uk">r00tuk</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=squeak-dev@lists.squeakfoundation.org
href="mailto:squeak-dev@lists.squeakfoundation.org">squeak-dev@lists.squeakfoundation.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, June 10, 2004 10:43
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> How to return array keys into
another array</DIV>
<DIV><BR></DIV><!-- Converted from text/rtf format -->
<P><FONT face=Arial size=2>Hello All</FONT> </P>
<P><FONT face=Arial size=2>I am quite new to smalltalk and am hoping someone
can help me or point me in the right direction as I am quite stumped by
this.</FONT></P>
<P><FONT face=Arial size=2>I have an array with elements either being 'free'
or 'reserved'. I am trying to get only the keys for all the element that
match 'free' into a new array.</FONT></P>
<P><FONT face=Arial size=2>Thanks for your time.</FONT> </P>
<P><FONT face=Arial size=2>Adrian</FONT> <BR><BR><FONT face=Arial
size=2>---<BR>Outgoing mail is certified Virus Free.<BR>Checked by AVG
anti-virus system (<A
href="http://www.grisoft.com">http://www.grisoft.com</A>).<BR>Version: 6.0.699
/ Virus Database: 456 - Release Date: 04/06/2004<BR></FONT> </P>
<P>
<HR>
<P></P><BR></BLOCKQUOTE></BODY></HTML>