Recursive functions - Postet den (1375 Views)
Development Team Member
Davio
Innlegg: 12217
12217
Anyone here have experience using recursive functions in ASP?
It's basically a function that calls itself, each time sending different values. So it's like a loop.
I am assisting someone here with a file upload mod and ran across the function calling itself to look through the folders and subfolders.
It's the first I have run into recursive functions in my years of coding so it's a little hard to grasp.
I am hoping one can replace this function with a loop?
   
 Sidestørrelse 
Postet den
Snitz Forums Admin
ruirib
Innlegg: 26364
26364
Recursiveness can't always be handled with a loop, at least not as easily. The difference is that in each fucntion call you are, in fact, providing a new context, so recursive functions are a neat way to handle complexity. Going recursively through folders is such a situation...
Postet den
Support Moderator
Shaggy
Innlegg: 6780
6780
I use them pretty extensively in JavaScript but don't think I've ever had need to use them in ASP. Now I know they're possible, though, I'm sure I'll find some use for them! wink
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
I use recursive functions all the time in .net and most other languages for that matter, they are generally the best way to accomplish complex iterative processes especially when the structures are tree like in nature
Postet den
Development Team Member
Davio
Innlegg: 12217
12217
Wow. Ok. 10 years coding and never run into recursive functions. But then again, Snitz Forums has been my teacher. lol
 
Du må legge inn en melding