2 Replies Latest reply on May 3, 2007 9:48 AM by adam@blueapplestudio

    Recursion and variables

    adam@blueapplestudio
      Here is my dilemma: I have a function where a handful of variables are set at the top. Then, these variables are used to make two comparisons with if statements. Inside each of these if statements, the function is called again with new arguments. Attached is a simplified version of my problem.

      As many of you will know without testing the function, the second if statement never evaluates to true because, while nOtherNumber is initially set to 3, its value is changed every time fTeachMeALesson is run from within the first if statement. Finally, nOtherNumber is set to 8, 8 is not less than 6, and the function stops.

      Is there a way I can get nOtherNumber (still equal to 3) to the second if statement before its value is changed? This may be more of a variable question than a recursion question, not sure.

      Any help is appreciated.