Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDebashish Palit
495 PointsIs he using recursion?
In the code, the function game() is being called from within itself. This is recursion. It could have been done without recursion as well. Why didn't Kenneth mention this point in the video?
2 Answers
Andrey Misikhin
16,529 PointsI think you did not pay attention, that Kenneth calls function "game()" not from the body of itself. Pay attention to the indentation.
Andrey Misikhin
16,529 PointsYes, you are right! But if you are already knew what the recursion is, that not a problem:) The use of recursion in this case is quite understandable, but there is no one right way to solve the problem. If you see other solutions, then this is very good!
Debashish Palit
495 PointsDebashish Palit
495 PointsThe following is the call to game() -
This is clearly being executed within the function game(). The indentation shows it. The call is, therefore, recursive.