We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents af301a2 + a56f648 commit affc815Copy full SHA for affc815
exercises/options/options1.rs
@@ -14,6 +14,7 @@ fn print_number(maybe_number: Option<u16>) {
14
// TODO: Return an Option!
15
fn maybe_icecream(time_of_day: u16) -> Option<u16> {
16
// We use the 24-hour system here, so 10PM is a value of 22
17
+ // The Option output should gracefully handle cases where time_of_day > 24.
18
???
19
}
20
@@ -24,8 +25,9 @@ mod tests {
24
25
#[test]
26
fn check_icecream() {
27
assert_eq!(maybe_icecream(10), Some(5));
- assert_eq!(maybe_icecream(23), None);
28
- assert_eq!(maybe_icecream(22), None);
+ assert_eq!(maybe_icecream(23), Some(0));
29
+ assert_eq!(maybe_icecream(22), Some(0));
30
+ assert_eq!(maybe_icecream(25), None);
31
32
33
0 commit comments