Generation

generate functionSat, 12 Nov 2022

Compute the factorial of a number in one line in an anonymous function with type annotations

fn factorial(n: i32) -> i32 { (1..n + 1).fold(1, |acc, x| acc * x) }

Want to kickstart your project?Use the new AI Studio to create your code