Re: Interrupt a block
- To: mathgroup at smc.vnet.net
- Subject: [mg125074] Re: Interrupt a block
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Mon, 20 Feb 2012 02:51:57 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jhqmbg$f5m$1@smc.vnet.net>
On 2/19/2012 1:27 PM, Sam Takoy wrote: > Hi, > > Is there a command for interrupting a block of code? > > For example, if I have a list of 10 commands, but I only want to > execute the first five? > Why do you need to interrupt it? There's Abort[] for a hard abort There's Interrupt[] which will interrupt and ask what you want to do There's Dialog[] that'll give you an interactive subsession at that point so you can inspect the kernel state There's Throw[] for returning (a value) from arbitrarily deep in an expression There's Return[], as well as the undocumented two argument form Return[val, fun] which returns from function fun There's Break[], Continue[], Goto[] ... As well as others. Can you explain why and how do you need to interrupt the calculation so we can give a more specific answer? -- Szabolcs Horvát Visit Mathematica.SE: http://mathematica.stackexchange.com/