Node:Global variables and recursion, Previous:Uncoordinated output, Up:Run-time errors
Global variables and recursion
Global variables and recursion usually do not mix. Make sure that the test for whether to "bottom out" your recursive function does not depend on a global variable. See Controlled recursion, for more information on why this is a bad thing.