2020-04-02 14:40:59 +02:00
|
|
|
// option1.rs
|
|
|
|
// Make me compile! Execute `rustlings hint option1` for hints
|
2020-03-05 22:52:54 +02:00
|
|
|
|
2020-04-02 14:40:59 +02:00
|
|
|
// I AM NOT DONE
|
2020-03-05 22:52:54 +02:00
|
|
|
|
2021-04-24 12:12:49 +02:00
|
|
|
// you can modify anything EXCEPT for this function's signature
|
2020-03-05 22:52:54 +02:00
|
|
|
fn print_number(maybe_number: Option<u16>) {
|
2020-03-11 19:44:10 +02:00
|
|
|
println!("printing: {}", maybe_number.unwrap());
|
2020-03-05 22:52:54 +02: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-05-27 10:50:24 +02:00
|
|
|
((iter * 1235) + 2) / (4 * 16)
|
2020-03-05 22:52:54 +02:00
|
|
|
};
|
|
|
|
|
2020-05-03 01:39:37 +02:00
|
|
|
numbers[iter as usize] = number_to_add;
|
2020-03-05 22:52:54 +02:00
|
|
|
}
|
2020-03-11 19:44:10 +02:00
|
|
|
}
|