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

Home » Public Forums » archive » CONTINUE from function within loop
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
CONTINUE from function within loop [message #86478] Tue, 12 November 2013 21:19 Go to previous message
spluque is currently offline  spluque
Messages: 33
Registered: September 2013
Member
Hi,

I read the CATCH and ON_ERROR help pages, but I can't see how to handle the following situation. Say we have a FOR loop where a function is called for each iteration:

FOR i=0, 10 DO BEGIN
print, myfun(i)
ENDFOR

I would like MYFUN to continue with the next iteration if it runs into an error. Naively, this should show what I'm looking for:

FUNCTION MYFUN, X

[BODY]

IF [condition] THEN BEGIN
message, 'A problem with X', /informational
CONTINUE
ENDIF

[REST IF OK]

RETURN, [something]

END

But, of course, CONTINUE only works within an FOR/ENDFOR block, not this way. How does one accomplish this?

Thanks,
Seb
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: covariance matrix
Next Topic: how to make lat/long grid for MODIS in IDL

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

Current Time: Wed Oct 08 13:32:13 PDT 2025

Total time taken to generate the page: 0.00424 seconds