-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Factorial exercise #15
Comments
Merged
Closed by #56!! 🎉 |
cedrickchee
pushed a commit
to cedrickchee/rustlings-solutions
that referenced
this issue
Nov 15, 2019
Tackles rust-lang/rustlings#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()
ppp3
pushed a commit
to ppp3/rustlings
that referenced
this issue
May 23, 2022
Tackles rust-lang#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()
FancyGeekGuru
added a commit
to FancyGeekGuru/rust-lings
that referenced
this issue
May 24, 2022
Tackles rust-lang/rustlings#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()
beephsupreme
added a commit
to beephsupreme/rustlings
that referenced
this issue
Jul 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think a factorial exercise would help people learn about Ranges and
.fold()
. As an example solution:The text was updated successfully, but these errors were encountered: