However, it ignores subdirectories. It would be useful if it could check files in subdirectories as well. Checking subdirectories is tricky, because a directory tree can have any number of branches of any length. You cannot know ahead of time how many levels of subdirectories to search. Recursion provides this functionality.
Recursion happens when a function calls itself.
To create a simple directory tree to test, create a subdirectory in your jabbertest directory called test . Make a copy of jabberwocky.txt and put the copy in the test subdirectory. If the condition of the first clause is true, the first clause is run and the second clause is ignored. If the condition of the first clause is false, and the condition of the second clause is true, the second clause is run. If the condition of the first clause is false, and the condition of the second clause is false, none of the if-expression is run.