MathGroup Archive 2000

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

Search the Archive

How to Break[] out of nested loops?

  • To: mathgroup at
  • Subject: [mg21790] How to Break[] out of nested loops?
  • From: Julián Aguirre <mtpagesj at>
  • Date: Thu, 27 Jan 2000 22:57:25 -0500 (EST)
  • Organization: Universidad del Pais Vasco/Euskal Herriko Unibertsitatea
  • Sender: owner-wri-mathgroup at

In a loop like

       If[condition[x,n], Break[]],
    {n, nmax}],
{m, mmax}]

the Break[] exits the inner loop. Is there a way of exiting out of the outer
loop? I do not want to write like

If[condition[x,n], Break[]],
{m, mmax},{n, nmax}]

because then LengthyComputation[m] is calculated nmax times for each value
of m isnstead of just once.

Thanks in advance.

Julian Aguirre
Universidad del Pais Vasco

  • Prev by Date: Re: Cell Group
  • Next by Date: Partial Differential Equations
  • Previous by thread: Re:& graphs and buttons
  • Next by thread: Re: How to Break[] out of nested loops?