Recursion just means something that calls itself.
Here’s an example: List all the files in all subfolders of a directory.
Your code outline might look something like this:
Function: parseFolder
Logic: List all files in the folder. Then, for each subfolder of this folder, call parseFolder.
Practically, what this is going to do is list all the files in each folder, go into the subfolders of that folder and list those files, go into the subfolders of *that* folder and list all the folders, etc, until there are no more subfolders to explore.
Latest Answers