Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8640

Re: Interrupt a block

From James Stein <mathgroup@stein.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Interrupt a block
Date 2012-02-20 07:51 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jhsu2n$nn7$1@smc.vnet.net> (permalink)
References <201202191127.GAA15526@smc.vnet.net>

Show all headers | View raw


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@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
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Interrupt a block James Stein <mathgroup@stein.org> - 2012-02-20 07:51 +0000

csiph-web