finish iterators4 exercise

This commit is contained in:
lukaszKielar 2020-06-30 20:06:31 +02:00
parent e63c871147
commit 2a9bd74176

View file

@ -1,7 +1,5 @@
// iterators4.rs
// I AM NOT DONE
pub fn factorial(num: u64) -> u64 {
// Complete this function to return the factorial of num
// Do not use:
@ -12,6 +10,7 @@ pub fn factorial(num: u64) -> u64 {
// For an extra challenge, don't use:
// - recursion
// Execute `rustlings hint iterators4` for hints.
(1..num + 1).into_iter().fold(1, |acc, x| acc * x)
}
#[cfg(test)]