rustlings-solutions/exercises/options/options1.rs
2022-07-14 17:34:50 +02:00

24 lines
548 B
Rust

// options1.rs
// Execute `rustlings hint options1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
// you can modify anything EXCEPT for this function's signature
fn print_number(maybe_number: Option<u16>) {
println!("printing: {}", maybe_number.unwrap());
}
fn main() {
print_number(13);
print_number(99);
let mut numbers: [Option<u16>; 5];
for iter in 0..5 {
let number_to_add: u16 = {
((iter * 1235) + 2) / (4 * 16)
};
numbers[iter as usize] = number_to_add;
}
}