Factorial (claude_code_sdk v0.0.1)
View SourceA module for calculating factorial of non-negative integers.
The factorial of n (denoted as n!) is the product of all positive integers less than or equal to n.
Summary
Functions
Calculates the factorial of a non-negative integer.
Functions
@spec calculate(non_neg_integer()) :: pos_integer()
Calculates the factorial of a non-negative integer.
Parameters
- n: A non-negative integer
Returns
The factorial of n
Examples
iex> Factorial.calculate(0)
1
iex> Factorial.calculate(5)
120
iex> Factorial.calculate(10)
3628800
Raises
ArgumentError - if n is negative or not an integer