Writing Recursive Functions : Function : Function Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Function » Function »

 

Writing Recursive Functions


 
package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

         trace(factorial(3))// Displays : 6

    }

     function factorial(i:uint):uint {
         if (i == 0) {
             return 1;
         else {
             return (i * factorial(i-1));
         }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Function
» Function