Jump to content

Can a function call itself?

Recommended Posts

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?

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...