View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

IRAF or Linux command to Continue a script

Elden Paul Iverson wrote on Feb 27, 2008

I am writing a script that works through a "while" loop. Within that loop there is an "if" statement that, if certain conditions are met, should trigger the script to skip the rest of the code and move to the next iteration of the "while" loop. I tried using the "continue" command but it fails when used inside of an "if" statement and simply continues running the rest of the script. I have used a break command before but I would prefer to just continue rather than exit the script. Does anyone have an idea of how I could write this into my code?

Thanks.

-Paul Iverson

Mike Fitzpatrick wrote on Feb 27, 2008

You want a 'next' instead of continue. E.g.


    for (i=0; i < 10; i=i+1) {
        if (i == 3) {
            next
        }
        print (i)
    }


would print all numbers < 10 except 3

-Mike

Last post on Feb 27, 2008