John is right about using loop actions in a recursive method call. It would be nice to be able to choose method or instance scope for the index of a loop action. Personally, I try to avoid loop actions. A FOR tag is much faster than a FOR action. Apart from that local/request scope is ideal for some things in recursion. You can accumulate results in a local array, or track how many levels deep in the recursion you are. You could do it all with method and instance scopes though. It depends on how you build your recursive algorythm.
Dave -----Original Message----- From: John McGowan [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 11:57 AM To: [EMAIL PROTECTED] Subject: Re: Witango-Talk: Witango 5 and recursion Alan Wolfe wrote: > Heya guys, > > I was wondering if there was a way to do recursion in witango 5? > Yes there is. > > my only problem here is that local variables will get overwritten when > i call the tcf function again inside itself right? > > Method scope would be overwritten too and instance seems like it might > work except id have to make a tcf object for each call of the function > which that would add alot of overhead right? No, this is incorrect. Method scoped variables are safe during recursion. You *do* need to stay away from Local/Request scoped variables though. The tricky part is that the default scope (which you can't change) for the Looping index of the for loop action is "Local" therefore you can't do your loops that way. You will need to do them in a while action instead and manage your looping indexes on your own. Like Dave said, you're on the right track. /John ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
