The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Intro to Recursion - Detecting an Infinite Loop

Intro to Recursion - Detecting an Infinite Loop

5:39
When using recursion, you must be mindful of the dreaded `infinite loop`. Using the recursive function that we’ve built up over the previous lessons, we look at how a simple duplicated configuration item could cause chaos for our program as it has no context of which items it has previously seen. We fix this problem by introducing a `parents` array, which can keep track of which top-level commands have already been accessed.
Watch this lesson now
Avatar
egghead.io

When using recursion, you must be mindful of the dreaded infinite loop. Using the recursive function that we’ve built up over the previous lessons, we look at how a simple duplicated configuration item could cause chaos for our program as it has no context of which items it has previously seen. We fix this problem by introducing a parents array, which can keep track of which top-level commands have already been accessed.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?