Re: Ideas for next Eu

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

Kat wrote:

> From: Greg Phillips <i.shoot at REDNECKS.COM>
> > Here's another program flow idea:
> > restart(id)
> > where id is the name of an enclosing function or procedure.
> > Consider the following:
> >
> > integer a
> > a = 0
> >
> > procedure test()
> >     a+=1
> >     if a != 2 then
> >         restart(test)
> >     end if
> > puts(1, "a = 2!!")
> > end procedure
> >
> > restart(test) implies that execution continues at the start of the
> procedure.
> > It could be used in conjunction with exit() to test for certain
> conditions.
> >
> > Useless?  Maybe.  But heck, it's an idea.
>
> Is that a "goto start of proc" or a recursive self-call ? Ie, do the vars
> get reset, or new vars built?
>
> Kat

The program just jumps to the start of the proc, with no resetting of vars.
Scope rules apply, however, so if a var is initialized *in* the proc, as
opposed to outside, as in the above example, it is reinitialized each time.

Greg

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

Search



Quick Links

User menu

Not signed in.

Misc Menu