Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11648
| From | Daniel <dosadchy@its.jnj.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Exiting a Nested operation... |
| Date | 2012-09-07 08:58 +0000 |
| Message-ID | <k2ccuo$f37$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
To exit Nest when some condition is met you can Throw an exception, like this: result=NestWhile[ (your code ... .. If[finalConditionIsMet, Throw[someResult]]; .. .. you code end), initial, True&]//Catch; This NextWhile is supposed to run indefinitely (because of the 'True&' as test function), but will exit when 'finalConditionIsMet' is True. For debug you should probably use something like this: result=Nest[ (your code ... .. If[finalConditionIsMet, Throw[someResult]]; .. .. you code end), initial, 50]//Catch; so the NestWhile will not run indefinitely if you have a bug.
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Exiting a Nested operation... Daniel <dosadchy@its.jnj.com> - 2012-09-07 08:58 +0000
csiph-web