How to Break[] out of nested loops?
- To: mathgroup at smc.vnet.net
- Subject: [mg21790] How to Break[] out of nested loops?
- From: Julián Aguirre <mtpagesj at lg.ehu.es>
- Date: Thu, 27 Jan 2000 22:57:25 -0500 (EST)
- Organization: Universidad del Pais Vasco/Euskal Herriko Unibertsitatea
- Sender: owner-wri-mathgroup at wolfram.com
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
- Follow-Ups:
- Re: How to Break[] out of nested loops?
- From: Jean-Marie Thomas <jmt@agat.net>
- Re: How to Break[] out of nested loops?