The function printGreeting()
is printed inside the function print()
in the sample code above. This is why "Hello" is printed twice when the program is executed. The function fibonacci()
is an example of recursion, a concept we will not be exploring in-depth in this course. Recursion is the act of calling the function in itself, as shown above. This creates a loop-like feature where the statements inside the functions are run multiple times before it returns a value. Feel fre to research more about recursion and how it works online. Knowing how to use recursion can drastically improve your programming skills and enable you to write more complex programs.