rustlings/exercises/option/option1.rs

23 lines
500 B
Rust
Raw Normal View History

2020-04-02 12:40:59 +00:00
// option1.rs
// Make me compile! Execute `rustlings hint option1` for hints
2020-03-05 20:52:54 +00:00
2020-04-02 12:40:59 +00:00
// I AM NOT DONE
2020-03-05 20:52:54 +00:00
2020-04-02 12:40:59 +00:00
// you can modify anything EXCEPT for this function's sig
2020-03-05 20:52:54 +00:00
fn print_number(maybe_number: Option<u16>) {
println!("printing: {}", *maybe_number);
}
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 * 5) + 2) / (4 * 16);
};
numbers[iter] = number_to_add;
}
}