Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

factorial

By Daniel · December 25, 2008

Computes the factorial of some number iteratively, avoid the overhead of recursion

// factorial(n)
// Computes the factorial of some number, n, iteratively

var result, i;
result = 1;

for (i = 1; i <= argument0; i += 1)
  result *= i;

return result;

Categories: Mathematics

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement