re: Challenge: Get Closest Number in an Array VIEW POST

FULL DISCUSSION
 

Rust 🦀

numbers.iter().min_by_key(|&num| (num - given_num).abs()).unwrap()
 

Nice, didn't know Rust had similar syntax to Ruby!

code of conduct - report abuse