Re: Looking for Stop
- To: mathgroup at smc.vnet.net
- Subject: [mg93096] Re: Looking for Stop
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sun, 26 Oct 2008 01:27:57 -0500 (EST)
- References: <gdugb5$jq8$1@smc.vnet.net>
Hi, Quit[] and Exit[] terminate the Kernel .. it is not a good idea to use it in a application. If you need a fool proof program you must write it in that way form the very first line. Return[]/Return[$Failed] or something like that are the functions in you program that terminate a function in case of "detect an irrecoverable error requiring user intervention" Regards Jens carlos at colorado.edu wrote: > Mathematica has two termination commands: > > Abort[] interrupts a computation > Exit[] or Quit[] returns control to OS > > I use Exit[] in some course-distributed application programs > that detect an irrecoverable error requiring user intervention > and program changes. This has an undesirable side effect: > all cells containing support modules have to be reinitialized. > Abort[] does not have that effect; however it doesnt stop > execution of whatever follows. > > Is there a command "in between" that stops kernel > execution but leaves cells initialized? Constraint: > it has to work with versions >=4.1. I looked for > Stop[] but there isnt such a thing under versions 4 or 5. > > Note: played with Throw and Catch, but this only terninates > the evaluation of whatever is inside Catch[...]. Not too > useful for big programs. I also tought to place a forward > Goto to a Label: at the end of the main program; > that doesnt work either since a label is not visible > until it is reached. > > What happens if the code hits Break[] and there is no enclosing > Do, For or While? Need to check that possibility. >