Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
>



  • Prev by Date: Re: Interrupt a block
  • Next by Date: Re: NProbability
  • Previous by thread: Interrupt a block
  • Next by thread: Re: Interrupt a block