You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This function returns how much icecream there is left in the fridge.// If it's before 22:00 (24-hour system), then 5 scoops are left. At 22:00,// someone eats it all, so no icecream is left (value 0). Return `None` if// `hour_of_day` is higher than 23.fnmaybe_icecream(hour_of_day:u16) -> Option<u16>{// TODO: Complete the function body.if hour_of_day < 22{Some(5)// If it's before 22:00 (24-hour system), then 5 scoops are left.}elseif hour_of_day == 22{Some(0)// At 22:00, someone eats it all, so no icecream is left (value 0)}elseif hour_of_day > 23{None// Return `None` if `hour_of_day` is higher than 23.}else{Some(0)// this is only here to satisfy the contradicting test case// assert_eq!(maybe_icecream(23), Some(0));}}
The text was updated successfully, but these errors were encountered:
https://github.com/rust-lang/rustlings/blob/main/exercises/12_options/options1.rs
options1.rs
maybe_icecream
undefined forhour_of_day == 23
The text was updated successfully, but these errors were encountered: