| Bill Allombert on Tue, 11 Aug 2020 15:56:42 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Question about a clean exit from a gp script |
On Tue, Aug 11, 2020 at 03:38:27PM +0200, Patrick De Geest wrote:
> Is there a neat way to leave or end a running gp script, from anywhere, even
> from
> within multiple nested loops, so that I come back straight at the pari
> prompt 'gp > '?
> 'Quit' doesn't work for me as the whole Pari application shuts down in my
> windows system.
> 'end', 'stop', 'system', 'goto' or whatever seems not to be implemented.
What about error() ?
> Just an example:
>
> uslvl=11;
> if(uslvl>6, warning("\n\nUser level "uslvl" too high!\n\n"); \*return
> strategy to the pari prompt*\ )
The only way to do a non-local jump in GP is to use iferr/error:
... if(uslvl>6, error("uslvl too high"));
main_function(...) =
{
iferr(main_function2(...), E, warning("\n\nUser level "uslvl" too high!\n\n")
, Vec(E)==["e_USER",["uslvl too high"]])
}
Cheers,
Bill