Re: Aborting a computation ...
- To: mathgroup at smc.vnet.net
- Subject: [mg93293] Re: Aborting a computation ...
- From: "sjoerd.c.devries at gmail.com" <sjoerd.c.devries at gmail.com>
- Date: Mon, 3 Nov 2008 05:25:32 -0500 (EST)
- References: <gejj0o$2j3$1@smc.vnet.net>
Ignacio, As far as I know, Abort[] aborts everyting in the execution chain that led to the execution of Abort[] itself. So, in your example it only aborts the If statement, not the following Print statement. Cheers -- Sjoerd On Nov 2, 8:57 am, Ignacio Plazeta <Ignacio.Plaz... at speednet.es> wrote: > Dear friends > > There is a conceptual lack in my > understanding of the way to stop > a computation; nor Abort[] neither > Interrupt[] works as I supposed > they do. > > The following code prints > "something" when myFolder > exists and when it doesn't. > > ------------------------------------ > myFolder="c\\someFolder"; > > errorLevel=Catch[ > > Off[SetDirectory::"cdir"]; > SetDirectory[myFolder]; > On[SetDirectory::"cdir"]; > > If[ > Directory[]!=myFolder, > > Print["Warning: folder non found ..."]; > Throw[0];, > > Throw[1]; > ]; > ]; > > If[errorLevel==0,Abort[]]; > > Print["something"]; > > ------------------------------------ > > Of course it may be fixed using: > > If[errorLevel == 0, > > Abort[]; > Print["something"]; > > ]; > > but, in the long run, the code > became too nested and the questions > about Abort[]/Interrupt[] still hangs. > > Warmest regards. > Ignacio > > ------------------------------------ > P.S. You see, I'm not a native > speaking English; I apologize for > my poor lamguage.