mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-23 23:50:25 +08:00
Merge pull request #340 from Gudahtt/return-largest-number
Return largest number instead of smallest
This commit is contained in:
commit
f266813b3a
@ -29,7 +29,7 @@ fn main() {
|
||||
let mut largest = numbers[0];
|
||||
|
||||
for number in numbers {
|
||||
if largest > number {
|
||||
if number > largest {
|
||||
largest = number;
|
||||
}
|
||||
}
|
||||
@ -58,7 +58,7 @@ fn main() {
|
||||
let mut largest = numbers[0];
|
||||
|
||||
for number in numbers {
|
||||
if largest > number {
|
||||
if number > largest {
|
||||
largest = number;
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ fn main() {
|
||||
let mut largest = numbers[0];
|
||||
|
||||
for number in numbers {
|
||||
if largest > number {
|
||||
if number > largest {
|
||||
largest = number;
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@ fn largest(numbers: Vec<i32>) {
|
||||
let mut largest = numbers[0];
|
||||
|
||||
for number in numbers {
|
||||
if largest > number {
|
||||
if number > largest {
|
||||
largest = number;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user