[Thread Prev][Thread Next][Index]

Re: EXIT in a REPEAT loop



Hi Lynn,

Thanks for reporting this problem -- we have not encountered it before. You
example (and Andrew's follow up) illustrate the need for more controls related
to the EXIT command:

EXIT/script -- exit from current script
EXIT/loop -- break from current repeat loop (or future FOREACH)
EXIT/prompt -- return to command prompt, regardless of current activity
EXIT/program -- terminate Ferret (the current "EXIT/command_file" to be
denegrated as misleading)

Comments or suggestions?

    - steve

P.S. This should be a quick fix -- we'll try to get it in soon.

==============================================

Lynn deWitt wrote:

> Hi all,
>      The Ferret users manual states the following about the  "EXIT"  command
>
> "When executed within a command file this command terminates the
> execution of the command file and returns control to the level in
> Ferret that executed the file (the user or another command file). "
>
> We've recently found that this works great unless EXIT is placed
> within a REPEAT loop.  Here's an example:  The command files test1
> and test2 exit back to test.jnl, but test3.jnl exits all the way back
> to the command prompt without executing test1 the second time.   Am I
> missing something or is this a "feature"?  Lynn
>
> test.jnl:
>
> let a=1
> let b=2
> let c=3
> go test1 a b c
> go test2 a b c
> go test3 a b c
> go test1 a b c
>
> where
>
> test1.jnl is
>
> list $1,$2,$3
> list $1
> exit
> list $2
> list $3
>
> test2.jnl is
>
> repeat/i=1:3 (list $1,$2,$3)
> list $1
> exit
> list $2
> list $3
>
> and test3.jnl is
> repeat/i=1:3 (list $1,$2,$3; exit)
> list $1
> exit
> list $2
> list $3
>
> the output is:
> %ferret
>          NOAA/PMEL TMAP
>          Program FERRET (GUI)
>          Version 4.91 - 05/19/98
>          18-Jul-01 12:50
>
> yes? go test
> let a=1
> let b=2
> let c=3
> go test1 a b c
> list $1,$2,$3
>   !-> list a,b,c
>   Column  1: A is 1
>   Column  2: B is 2
>   Column  3: C is 3
>               A      B      C
> I / *:    1.000  2.000  3.000
> list $1
>   !-> list a
>               1
>            1.000
> exit
> go test2 a b c
> repeat/i=1:3 (list $1,$2,$3)
>   !-> repeat/i=1:3 (list a,b,c)
> !-> REPEAT: I=1
>   Column  1: A is 1
>   Column  2: B is 2
>   Column  3: C is 3
>               A      B      C
> I / *:    1.000  2.000  3.000
> !-> REPEAT: I=2
>   Column  1: A is 1
>   Column  2: B is 2
>   Column  3: C is 3
>               A      B      C
> I / *:    1.000  2.000  3.000
> !-> REPEAT: I=3
>   Column  1: A is 1
>   Column  2: B is 2
>   Column  3: C is 3
>               A      B      C
> I / *:    1.000  2.000  3.000
> list $1
>   !-> list a
>               1
>            1.000
> exit
> go test3 a b c
> repeat/i=1:3 (list $1,$2,$3; exit)
>   !-> repeat/i=1:3 (list a,b,c; exit)
> !-> REPEAT: I=1
>   Column  1: A is 1
>   Column  2: B is 2
>   Column  3: C is 3
>               A      B      C
> I / *:    1.000  2.000  3.000
> %(exited all the way out of ferret back to the command prompt)
> --------------------------------------------
> Lynn deWitt
>
> ldewitt@pfeg.noaa.gov
>
> Pacific Fisheries Environmental Laboratories
> 1352 Lighthouse Avenue
> Pacific Grove, CA 93950-2097
> (831)-648-9036

--
Steve Hankin
NOAA/PMEL, 7600 Sand Point Way NE, Seattle, WA 98115-0070
ph. (206) 526-6080 -- FAX (206) 526-6744




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement