Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main(){
- let mut a = (1..10).peekable();
- let b = std::iter::repeat(()).map(|()| {
- let mut current = a.next();
- if let Some(current) = current.as_mut() {
- if let Some(next) = a.peek() {
- if next % 2 == 1 { *current *= 2 }
- }
- }
- current
- });
- }
Add Comment
Please, Sign In to add comment