Re: question about the function "go to"
- To: mathgroup at smc.vnet.net
- Subject: [mg85187] Re: question about the function "go to"
- From: Szabolcs <szhorvat at gmail.com>
- Date: Thu, 31 Jan 2008 05:44:13 -0500 (EST)
- References: <fnrnmk$ojv$1@smc.vnet.net>
On Jan 31, 6:52 am, Paolo Di Giovanni <dijo... at yahoo.it> wrote: > I've got a problem in teh using of mathematica:I'm using the function "go to" because I have to close a loop....the program should come back to a label that I've called Label [05] but in this point I've got the problem...I mean, the function go to doesn't send me to the label...how would I solve this with Mathematica? Since you didn't describe what you were doing, it is not possible to give a straight answer. The preferred approach in Mathematica is solving the problem without an explicit loop (like For or While). Most of the time (but not always) this is the fastest and most compact solution. If this is not possible/convenient, get rid of the Goto[]. There is practically no use at all for this construct in the Mathematica language, and in most cases there are better alternatives to goto in procedural languages too. Also note that 05 and 5 represent the same atom in Mathematica. You might find the functions Break, Continue, Throw and Catch useful, too.