comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: "foreach" loops in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: "foreach" loops in IDL [message #64803 is a reply to message #64798] Fri, 16 January 2009 11:37 Go to previous messageGo to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
My opinion is that something like that make the
code more difficult to understand and prevent
utilization in two different programs running at the
same time in the same session because of the
common blocks.

Therefore, I don't like the idea very much.

Ciao,
Paolo

alaniwiuse...@googlemail.com wrote:
> In case anyone's interested, I've produced a little hack that lets you
> have "foreach" loops in IDL, i.e. loop over the contents of an array.
> It would be nice if the syntax were to let you have something like:
>
> for myval in myarray do begin
> print, myval
> endfor
>
> Unfortunately it doesn't, unless I've missed something somewhere. And
> it's just a little fiddly to have to loop over an array index every
> time, e.g.:
>
> for i=0, n_elements(myarray) - 1 do begin
> myval = myarray[i]
> print, myval
> endfor
>
> The hack lets you use the following syntax:
>
> foreach, 'myval', myarray
> @do
> print, myval
> @done
>
> and nested loops are supported.
>
> If anyone is interested in having this, grab this a (tiny) download,
> that contains a few short files to put somewhere in your IDL_PATH:
>
> http://home.badc.rl.ac.uk/iwi/idl-foreach.tar.gz
>
> Regards,
> Alan
>
> P.S. Please note that I do not read this mailbox. Do a web search for
> "Alan Iwi" if you want my email address.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: ERRPLOT using object Graphics .... ?
Next Topic: Contour command

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 18:18:56 PDT 2025

Total time taken to generate the page: 1.43896 seconds