1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-01-22 04:08:38 +02:00

24 lines
504 B
Rust
Raw Normal View History

2020-03-05 15:52:54 -05:00
//option1.rs
//Make me compile! Execute `rustlings hint option1` for hints
//I AM NOT DONE
//you can modify anything EXCEPT for this function's sig
fn print_number(maybe_number: Option<u16>) {
2020-03-11 13:44:10 -04:00
println!("printing: {}", maybe_number.unwrap());
2020-03-05 15:52:54 -05:00
}
fn main() {
print_number(13);
print_number(99);
let mut numbers: [Option<u16>; 5];
for iter in 0..5 {
let number_to_add: u16 = {
2020-03-11 13:44:41 -04:00
((iter * 5) + 2) / (4 * 16)
2020-03-05 15:52:54 -05:00
};
numbers[iter] = number_to_add;
}
2020-03-11 13:44:10 -04:00
}