Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!godot.cc.duq.edu!newsgate.duke.edu!news.mathworks.com!newsfeed.internetmci.com!hunter.premier.net!netnews.worldnet.att.net!ix.netcom.com!netcom.net.uk!dispatch.news.demon.net!demon!usenet2.news.uk.psi.net!uknet!usenet1.news.uk.psi.net!uknet!psinntp!psinntp!psinntp!ncrgw2.ncr.com!ncrhub2!eurohub!ddvictor.dundee.ATTGIS.COM!news
From: Tony Mochan <tmochan@wizardpost.dundee.ncr.com>
Subject: [Q] For loops indices ... to: do:
X-Nntp-Posting-Host: 153.73.152.193
Content-Type: text/plain; charset=us-ascii
Message-ID: <31E4DA8A.30ED@wizardpost.dundee.ncr.com>
Sender: news@ddvictor.dundee.ATTGIS.COM (Ref news)
Reply-To: tmochan@wizardpost.dundee.ncr.com
Content-Transfer-Encoding: 7bit
Cc: amochan@mcs.dundee.ac.uk
Organization: NCR (Scotland) Ltd
Mime-Version: 1.0
Date: Thu, 11 Jul 1996 10:42:18 GMT
X-Mailer: Mozilla 3.0b3Gold (Win95; I)
Lines: 37

I am quite new to Smalltalk programming (but not to OOP).

I'm using Digitalk Smalltalk V.

I have the following code:

    1 to: ((printQueue asOrderedCollection) size) do: [ :i |	
    printQueue:= printQueue remove:(printQueue at: i) ifAbsent:[self 
debugMessage: ('Bugger!')].
	].

I also have a conditional statement around the remove part which is not 
relevant - I'm not trying to remove the whole OrderedCollection!

However ... this sometimes results in several errors including not being 
able to find the last item in the OrderedCollection printQueue.

This looks as though it is due to trying to reference a key in the 
OrderedCollection that no longer exists.  Therefore I am assuming that 
the to:(printQueue size) statement can only be evaluated once (at the 
beginning) or something.

Is there any way round this (or any way to trap the errors).

Out office guru is away on holiday ... can anyone help ... please!

If this is not a complete enough statement of the problem ... please 
reply!

Many thanks.

--
Tony Mochan
Technology Development Division
NCR (Scotland) Ltd.
tmochan@wizardpost.dundee.ncr.com
Phone : +44 1382 59 8329  Fax : +44 1382 59 8313
