2026-02-07 20:27 UTC
The fun part is you can use this shorthand in if statements:
if let Some(val) = my_iter.next() {
println!(“Next iter value: {val}”);
} else {
println!(“No more values");
}
Which naturally implies it also works with while loops:
while let Some(val) = my_iter.next() {
println!("Value: {val}”);
} (2/2)
Replies (0)
No replies.