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

Re: simple question



Isn't breaking out of DO loops the same as using conditional loops? FOR
/ DO have a particular purpose, to execute a  certain number of times.
For repeating under a condition, WHILE and REPEAT are provided, I think.
Cheers,
Pavel

Paul van Delst wrote:
> 
> 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
> >   NEXT_VAL:
> > endfor
> > DONE_VAL:O