Sign in to follow this  
Followers 0
valkk

Can a function call itself?

2 posts in this topic

I'm working with a tree directory (not file, just list of categories) and I'm trying to make a script to navigate it. Relatively it would be easy, however the depth of sub-categories differs for each choice. The only way I can think of is using only one function calling itself after viewing the next set of categories. So let's say you have the options [Processors,Graphics Processors,Harddrives] and you choose [Processors], now you have the option of [intel,AMD,Via] and the process continues when choosing another option. So I start the function to navigate the first set of categories, then when [processors] would be choosen the same function would be called, now I would have functions 2 levels deep, just like in the tree directory. That way when I go back, I can still navigate the previous categories.

Sounds easy enough, as long as it's possible. So is it possible for a function to call itself?

Share this post


Link to post
Share on other sites



Search the forum for recursion.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0