mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2024-11-28 06:10:17 +00:00
Changed to use inclusive range operator (#632)
This commit is contained in:
parent
9953362df2
commit
1b9a276ed2
1 changed files with 1 additions and 1 deletions
|
@ -9,7 +9,7 @@ use num::bigint::{BigInt, ToBigInt};
|
|||
|
||||
fn factorial(x: i32) -> BigInt {
|
||||
if let Some(mut factorial) = 1.to_bigint() {
|
||||
for i in 1..(x+1) {
|
||||
for i in 1..=x {
|
||||
factorial = factorial * i;
|
||||
}
|
||||
factorial
|
||||
|
|
Loading…
Reference in a new issue