MathGroup Archive 2012

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

Search the Archive

Re: Interrupt a block


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