Recursion: in computer science and Swift this is the process whereby a function calls itself. A recursive function must have a base case and the recursive call.
func countDownToSwiftVersion1(_ n: Int) {
guard n > 0 else { return } // base case
print("Swift Version \(n)")
countDownToSwiftVersion1(n - 1) // recursive call
}
countDownToSwiftVersion1(5)
/*
Swift Version 5
Swift Version 4
Swift Version 3
Swift Version 2
Swift Version 1
*/Introduction to recursion and visualizing function calls being placed on the call stack using breakpoints.