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.