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

Home » Public Forums » archive » Starting a for loop within an if loop
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Starting a for loop within an if loop [message #57645] Wed, 19 December 2007 19:57
Mat Smith is currently offline  Mat Smith
Messages: 4
Registered: December 2007
Junior Member
Hi,
I'm trying to write a program with some keywords, so that depending
upon my mood I can alter what it does.

What I want to do is most of the time just run the program, but I want
to include an option to do a for loop.

Basically, I need something like:

IF keyword_set(mc) THEN BEGIN
FOR i=0,n-1 DO BEGIN
t=d[i]
ENDIF

and later in the program

IF keyword_set(mc) THEN BEGIN
ENDFOR
ENDIF

Thus the rest of the program runs normally with and without the for
loop (it just uses t).
However, IDL doesn't understand this - it wants an ENDFOR before the
ENDIF.

Any thoughts on how I can get around this? It's entirely possible that
I'm missing something obvious.
Thanks
Mat
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help requested in eradicating FOR loops
Next Topic: Re: Another Nit Needs Fixing

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

Current Time: Fri Oct 10 06:29:11 PDT 2025

Total time taken to generate the page: 0.24160 seconds