Creating Recursion function : Function : Function Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Function » Function »

 

Creating Recursion function


 

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

        trace(factorial(3));

    }

    function factorial(nOperand:Number):Number{
      if(nOperand > 0){
        return nOperand * factorial(nOperand - 1);
      }
      else{
        return 1;
      }
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Function
» Function