Re: How can I STOP a cursed recursion?

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

ChrisBurch2 wrote:
> 
> Hi
> 
> Sorry, stuff got a bit garbled.
> 
> I tend to use functions, because its easier to break out of a function than
> 
> a procedure.
> 
> This is the way I do it
> 
> Generally you need a global indicator variable. This tells the loop, and all
> previous loop iterations to stop.
> 
> An infinite loop within the procedure
> 
> }}}
<eucode>
> integer break_free --this is global to the program
> break_free = 0
> 
> procedure foo()
> 
> while 1 do
>    if break_free = 1 then
>        exit
>    end if
> 
>    --do stuff
> 
>    --are conditions met to exit loop
>    if conditions met then
>         break_free = 1
>    end if
> 
>    foo()
> 
> end while
> 
> 
> end procedure
> 
> </eucode>
{{{

> 
> Note the position of loop testing, and setting the global break free
> variable - if you've recursed (?) 10 times, then you exit the loop 10 times
> 
> You must also reset break_free to 0 immediately after calling foo() for the
> first time
> 
> Chris

Chris,

I must have done something like what you said, because I DID GET MY RECURSION
TO STOP, and I did have a while-loop in it that might have been at least
part of the problem.  

I left a message here just about the time you wrote the above, to let people
know that with all of your help the problem was solved, BUT IT DIDN'T GET
POSTED. 

And about 15 minutes or so ago I resent a similar message, when I finally
saw that the earlier one never made it here, and THAT ONE never has shown up
either.

I'm hoping this will show up on the forum so all who replied to my question
will know IT'S SOLVED (as far as I can tell), and that I'm grateful for the
help.

Thanks,
Dan

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

Search



Quick Links

User menu

Not signed in.

Misc Menu