Re: Interrupt a block
- To: mathgroup at smc.vnet.net
- Subject: [mg125065] Re: Interrupt a block
- From: James Stein <mathgroup at stein.org>
- Date: Mon, 20 Feb 2012 02:48:49 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201202191127.GAA15526@smc.vnet.net>
Throw or Goto.
The "Loops and Control Structures" tutorial contains
this example, which seems to be exactly what you want:
Catch [ Do [ Print [ i ]; If [ i > 3, Throw [ i ] ] , { i, 10 } ] ]
On Sun, Feb 19, 2012 at 3:27 AM, Sam Takoy <sam.takoy at yahoo.com> 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?
>
> Thanks!
>
> Sam
>
- References:
- Interrupt a block
- From: Sam Takoy <sam.takoy@yahoo.com>
- Interrupt a block