Re: How can I STOP a cursed recursion?
- Posted by Igor Kachan <kinz at peterlink.ru> Jun 19, 2006
- 522 views
Dan Moyer wrote: > > > With some difficulty, I built a recursive procedure, which seems to work > fine, except that I can't get it to STOP. > > It knows when it gets to where it should stop, & I put return in at that > point, & when that didn't work, I set an external variable to 1 (=finished) > when it got to that point, and added a test at the beginning of the procedure > to "return" if it saw that var "finished", but that didn't work either. > > The procedure was to take a sequence of sequences like what "folder" would > have when adding items to a TreeView, and go thru them to compute the correct > positions to put those items into in a "horizontal" treeView. The procedure > worked thru the items in a correct fashion, got to the last item just below > the root item, knew it was where it should stop, but continues to maybe > "unravel" previous left-over recursions, or something????? > > Is there some way to just STOP a procedure, even if it has been working > recursivly?? Or maybe recursion is supposed to be limited to FUNCTIONS? > > > procedure Help!() > print(1,"help!") > Help{} > -- How can I stop!? > end procedure > > Help! > > Dan Hi Dan, Try please:
procedure Help() if get_key()!=-1 then return end if print(1,"help!") Help() -- How can I stop!? end procedure Help()
Regards, Igor Kachan kinz at peterlink.ru