use std::io;

fn main() {
    let a = [1, 2, 3, 4, 5];

    println!("Please enter an array index.");

    let mut index = String::new();

    io::stdin()
        .read_line(&mut index)
        .expect("Failed to read line");

    let index: usize = match {index.trim().parse()} {
        Ok(x) => x,
        Err(_) => {println!("expected an index, got \"{:}\". assuming 0", index.trim()); 0},
    };

    println!("got value {index}");

    let element = a[index];

    /* this is a 
     * multiline
     * comment */
    println!("The value of the element at index {index} is: {element}");
}
