1. While I'm using the 'Guest' post

posted by: g.haberek at comcast.net

I've been using a lot of loops lately, and I've noticed I need something. I'd
like to see a 'next' statement in Euphoria. I'd like to be able to do this:

for i = 1 to 10 do

    if i = 3 then  -- i don't like 3 :)
        next  -- go to next step
    end if

end for

~Greg

new topic     » topic index » view message » categorize

2. Re: While I'm using the 'Guest' post

Guest wrote:

>
>
>posted by: g.haberek at comcast.net
>
>I've been using a lot of loops lately, and I've noticed I need something. I'd
>like to see a 'next' statement in Euphoria. I'd like to be able to do this:
>
>  
Actually, that's traditionally called 'continue'. 'Next' implies a 
marker at the end of a loop to anyone who started out with Basic (lots 
of us).

>for i = 1 to 10 do
>
>    if i = 3 then  -- i don't like 3 :)
>        next  -- go to next step
>    end if
>
>end for
>
>~Greg
>
>
>
>TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: While I'm using the 'Guest' post

Go program powerbasic for that

> posted by: g.haberek at comcast.net
>
> I've been using a lot of loops lately, and I've noticed I need something. I'd
> like to see a 'next' statement in Euphoria. I'd like
to be able to do this:
>
> for i = 1 to 10 do
>
>     if i = 3 then  -- i don't like 3 :)
>         next  -- go to next step
>     end if
>
> end for
>
> ~Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: While I'm using the 'Guest' post

On 23 Jan 2004, at 23:42, Euman wrote:

> 
> 
> Go program powerbasic for that
> 
> > posted by: g.haberek at comcast.net
> >
> > I've been using a lot of loops lately, and I've noticed I need something.
> > I'd
> > like to see a 'next' statement in Euphoria. I'd like
> to be able to do this:
> >
> > for i = 1 to 10 do
> >
> >     if i = 3 then  -- i don't like 3 :)
> >         next  -- go to next step
> >     end if
> >
> > end for

How about this:

 for i = 1 to 10 do
 :restart
     if i = 3 then  -- i don't like 3 :)
        goto next  -- go to next step
     end if

   if equal(junk,-1) then -- something broke
    goto restart -- try again
  end if

 :next
 end for

Kat

new topic     » goto parent     » topic index » view message » categorize

5. Re: While I'm using the 'Guest' post

Hi Guest,

----------
> I've been using a lot of loops lately, and I've 
> noticed I need something. I'd
> like to see a 'next' statement in Euphoria. 
> I'd like to be able to do this:
>
> for i = 1 to 10 do
>
>     if i = 3 then  -- i don't like 3 :)
>         next  -- go to next step
>     end if
>
> end for

EU has efficient ways to do the
same and better things just now:

1.

sequence I
I = {1,2,4,6,7,9,10}

for i=1 to length(I) do  -- I does not have 3,5,8
  -- code to do with I[i]
end for -- more fast loop, without if...end if
--------

2.

for i = 1 to 10 do
  if i != 3 then -- i don't want 3 too
   --  what to do
  end if
end for -- as fast as 'next', with if...end if

This is EU -- just now!

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu