Re: goto and label (cont)

*To*: mathgroup at smc.vnet.net*Subject*: [mg57821] Re: goto and label (cont)*From*: "Stefan Linnik" <- at mk-nntp-1.news.uk.worldonline.com>*Date*: Thu, 9 Jun 2005 05:18:14 -0400 (EDT)*References*: <d83rft$s68$1@smc.vnet.net> <d868ce$bu0$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

How about something like: i= 0; Do[ i= i+1; Print["something 1 = ", i]; If[i <=3, Continue[] ]; i= i+10; Print["something 2 = ", i]; If[i < 30, Continue[] ], {7} ] Print["something else"]; something 1 = 1 something 1 = 2 something 1 = 3 something 1 = 4 something 2 = 14 something 1 = 15 something 2 = 25 something 1 = 26 something 2 = 36 something 1 = 37 something 2 = 47 something else Stefan Linnik ~~~~~~~~ "Guy Israeli" <guyi1 at netvision.net.il> wrote in message news:d868ce$bu0$1 at smc.vnet.net... > Hi again, > > since everyone tells me not to use goto and label (although for the use > i'll > describe below it is very comfterable and the simplest way to do it. If > anyone can suggests an alternative/mathematica way of doing it, please do. > > the pseudocode with goto > > label[l] > do something1 > if condition1==true goto[l] > do something2 > if condition2==true goto[l] > do some other stuff > > as you see i do something1 then check some cond. if something didn't go > well > i start doing everything from the start. same for something2. I want to go > all the way to the top. using a while or something alike would need some > variable to hold it and maintaine which is messy. or if a do while loop > exists (?) it will need to do everything and then restart. I want some > mechanism that will restart itself if conditions are not met. goto seems > the > only simple option to do it. > > again, suggestions are always welcomed > > Thanks a lot, > > Guy > >