Re: How to Break[] out of nested loops?

*To*: mathgroup at smc.vnet.net*Subject*: [mg21804] Re: [mg21790] How to Break[] out of nested loops?*From*: Jean-Marie Thomas <jmt at agat.net>*Date*: Fri, 28 Jan 2000 01:45:54 -0500 (EST)*Organization*: TeA*References*: <200001280357.WAA10923@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Use the Catch Throw commands : Catch[ myMultiLeveledLoopContainingAThowClause[] ] On Fri, 28 Jan 2000, Julin Aguirre wrote: > In a loop like > > Do[ > x=LengthyComputation[m]; > Do[ > 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 > > Do[ > x=LengthyComputation[m]; > 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

**References**:**How to Break[] out of nested loops?***From:*Julián Aguirre <mtpagesj@lg.ehu.es>