Here is factorial function in Actionscipt 3,
To use it
Hope it helps
package{
public class MyMath{
public static function factorial(index:uint) : uint {
var total:uint = index;
if(index > 0){
total += MyMath.factorial(index - 1);
}
return total;
}
}
}
To use it
trace(MyMath.factorial(3));
Hope it helps
You mean:
ReplyDeletetotal *= MyMath........
In addition to DBLacis comment: Shouldn't that be if(index > 1) to avoid *0 ?
ReplyDeleteAnd put the return to Number so it allow 20! for example..
ReplyDelete