factorial[n_Integer] := Block[{i, result = 1}, For[i = 1, i <= n, ++i, result *= i]; result]