Skip to content

Conversation

@ShaharNaveh
Copy link
Contributor

@ShaharNaveh ShaharNaveh commented May 15, 2025

I think that it would be helpful to note a way using a single iteration using fold.

let max = numbers.iter().max().unwrap();
println!("max: {}", max);

let (min, max) = numbers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would normally put this at the bottom of the function. but on line 22 numbers moves, so this example comes before.
I can move this example to the bottom and clone numbers if this is super critical

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant