Commit Graph

2 Commits (05fcc8d629d481722fcafc8353394874de8d9546)

Author SHA1 Message Date
Robert Lugg 7d7a48b17d Added filename to top of .rs files 7 years ago
Matthew Williamson e0274e07d0 Create iterators4.rs
Tackles https://github.com/carols10cents/rustlings/issues/15 . I think this allows for varying levels of difficulty depending on a users background. But ideally people can move there way up from 1, 2, 3 (Numbers below).

1. 
    let mut result = 1;
    for i in 1..x + 1 {
        result *= i;
    }
    result

2. 
    match x {
        0 | 1 => 1,
        x => x * factorial(x - 1),
    }
3. 
    (1..x + 1).product()
8 years ago