----- Original Message ----- From: "Jason Lutes" <[EMAIL PROTECTED]>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Friday, April 25, 2008 6:09 PM
Subject: Re: [Flashcoders] How to check Recursive Function is finished


I occasionally place code at the end of the function to detect when it's not being invoked by itself.

Then you are just avoiding creating two functions by adding special conditions to one function.

You are essentially doing the following kind of thing but inside one function :

function A(somevalue:Number):void {
   B(somevalue);
   // do something else here
}

function B(somevalue::Number):void {
   if (somevalue > 0){
       B(--somevalue);
}

A(10);

To my mind it would be better not to complicate the recursive function just for the sake of avoiding writing what's really going on.

Paul

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to