We can obsolete errata, we have the technology
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.
pub fn factorial_recursive(n: u64) -> u64 {
match n {
0 => 1,
_ => n * factorial_recursive(n - 1),
}
}
DITA
<p>In mathematics, the factorial of a non-negative integer <i>n</i>,
denoted by <i>n</i>!, is the product of all positive integers less than or
equal to <i>n</i>.</p>
<codeblock><coderef
href="src/lib.rs#token=start_fact_rec,end_fact_rec"/></codeblock>
// start_fact_rec
pub fn factorial_recursive(n: u64) -> u64 {
match n {
0 => 1,
_ => n * factorial_recursive(n - 1),
}
}
// end_fact_rec
#[test]
fn test() {
assert_eq!(1, factorial_recursive(1));
assert_eq!(2, factorial_recursive(2));
assert_eq!(6, factorial_recursive(3));
assert_eq!(24, factorial_recursive(4));
assert_eq!(120, factorial_recursive(5));
assert_eq!(720, factorial_recursive(6));
assert_eq!(5040, factorial_recursive(7));
assert_eq!(40320, factorial_recursive(8));
assert_eq!(362880, factorial_recursive(9));
}