[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple question

Craig Markwardt wrote:
> "richard hilton" <rdh5@dmu.ac.uk> writes:
> > This probably sounds like a stupid question but does anybody know of an IDL
> > equivilent to the CONTINUE command in C/C++ ? Your help would be much
> > appreciated.
> I've wished for an equivalent to continue and break, but have never
> found it.  You will have to do use GOTO explicitly.
> for i = 0, n-1 do begin
>   if val(i) EQ 0 then goto, NEXT_VAL ;; equivalent to continue
>   compute_val, val(i)
>   if val(i) LT 0 then goto, DONE_VAL ;; equivalent to break
> endfor

If there's one thing I loathe, it's GOTO'ing _out_ of DO/IF
loops/constructs. I, too, wish IDL would introduce statements such as
the CYCLE (equiv to CONTINUE) and EXIT (equiv to BREAK) statements in
F90/F95. Sure makes logic in DO loops and IF constructs supa-easy to
follow (although I have to admit the example above is clear and easy to

How would one begin the process of doing this, i.e. getting RSI to
introduce new control transfer statements such as CYCLE and BREAK? I
can't see that it would be a terribly difficult thing to do but I don't
write compiler type stuff.

Paul van Delst           Ph:  (301) 763-8000 x7274 
CIMSS @ NOAA/NCEP        Fax: (301) 763-8545
Rm.202, 5200 Auth Rd.    Email: pvandelst@ncep.noaa.gov
Camp Springs MD 20746