RE: WISHLIST.TXT

new topic     » topic index » view thread      » older message » newer message

> -----Original Message-----
> From: Derek Parnell [mailto:ddparnell at bigpond.com]

>> From: <christian.cuvier at education.gouv.fr>

> >
> > while <cond1> do
> >     ...
> >     if <cond2> then end while end if
> >     ...
> >     if <cond3> then end while end if
> >     ...
> > end while

> Not really. By "end loop" I assume you are telling the 
> interpreter to finish
> looping through the current loop block. If so, what is the difference
> between "end loop" and the current "exit" statement?

No, he means to go back to the top of the loop for the next iteration.
Here's a silly example:

for i = 1 to 10
  if remainder(i,3) = 0 then
    resume
  end if
  printf(1, "%d is divisible by 3!\n", i)
end for

So you should see:

3
6
9

I typically use a big if statement to do that sort of thing (of course this
is really trivial):

for i = 1 to 10
  if remainder(i,3) != 0 then
    printf(1, "%d is divisible by 3!\n", i)
  end if
end for

I suspect that this shouldn't be terribly difficult to do in the source.  I
*think* I see an easy way to do it by basically adding a case (or two).  The
only thing that would slow me down would be adding stuff into the parser,
which I haven't done yet--a lot of that stuff is still a black box to me. :)

The controlled exit looks like it would take some more work--mainly checking
to see how many/which loops you need to wrap up.

Matt Lewis

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu