Array iter's type

A array of Option type, How to get the index of iter

If I understand your question:

fn main() {
    let array = [Some(1), None, None, None];
    for (idx, x) in array.into_iter().enumerate() {
        println!("{idx}: {x:?}");
    }
}
1 Like

Thanks! Great!