You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnlargest<T>(list:&[T]) -> &T{letmut largest = list[0];for item in list {if item > largest {
largest = item;}}
largest
}fnmain(){let number_list = vec![34,50,25,100,65];let result = largest(&number_list);println!("The largest number is {}", result);let char_list = vec!['y','m','a','q'];let result = largest(&char_list);println!("The largest char is {}", result);}
fnlargest<T>(list:&[T]) -> &T{letmut largest = &list[0];for item in list {if item > largest {
largest = item;}}
largest
}fnmain(){let number_list = vec![34,50,25,100,65];let result = largest(&number_list);println!("The largest number is {}", result);let char_list = vec!['y','m','a','q'];let result = largest(&char_list);println!("The largest char is {}", result);}
let mut largest = list[0]; was changed to let mut largest = &list[0]; by a4780b9 which was forgotten by 43565d3. But the rustbook is not changed.
This would fix #2453 . And there is no need to revert changes in #2460 .
The text was updated successfully, but these errors were encountered:
Listing 10-5 in Chapter 10.1:
Actual code in listing-10-05/src/main.rs
let mut largest = list[0];
was changed tolet mut largest = &list[0];
by a4780b9 which was forgotten by 43565d3. But the rustbook is not changed.This would fix #2453 . And there is no need to revert changes in #2460 .
The text was updated successfully, but these errors were encountered: