Click or drag to resize

Fact Function

Calculate the factorial of a number.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION Fact(
	wValue AS DWORD
) AS FLOAT
View Source

Parameters

wValue
Type: UInt32
A positive number.

Return Value

Type: Float
Remarks
The factorial of an integer n is computed as follows:
X#
Factorial(n)=n*(n-1)*(n-2) ... 3*2*1
The factorial of 0 is defined to be 1.
Examples
This example uses Fact() to compute the factorial of 5, then it verifies the result:
X#
? Fact(5)                                        // 120
// Verify
? 5*4*3*2*1                                        // 120
See Also