dos_fact - dalefugier/DOSLib GitHub Wiki

Returns the factorial of a number. The factorial of a number is equal to 1 x 2 x 3... number.

Syntax

(dos_fact number)

Parameters

number

The nonnegative number you want the factorial of. If number is not an integer, it is truncated.

Returns

The factorial, if successful.

nil on error.

Example

Command: (dos_fact 5)
120
Command: (dos_fact 1.9)
1
Command: (dos_fact 0)
1
Command: (dos_fact -1)
nil
Command: (dos_fact 1)
1