Commit Graph

2 Commits

Author SHA1 Message Date
Robert Lugg 7d7a48b17d Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
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()
2017-01-05 22:38:07 -05:00