mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-29 00:00:04 +03:00
Compare commits
7 commits
9691c3cb55
...
4e59857228
Author | SHA1 | Date | |
---|---|---|---|
4e59857228 | |||
c2b7f45806 | |||
c6597d0010 | |||
1a4f55e0e6 | |||
30273a6ee5 | |||
eb952a480d | |||
f2833c5279 |
|
@ -2721,6 +2721,15 @@
|
|||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "loshz",
|
||||
"name": "Dan",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/3449337?v=4",
|
||||
"profile": "https://loshz.com",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 8,
|
||||
|
|
|
@ -384,6 +384,7 @@ authors.
|
|||
<td align="center" valign="top" width="12.5%"><a href="http://wznmickey.com"><img src="https://avatars.githubusercontent.com/u/44784663?v=4?s=100" width="100px;" alt="wznmickey"/><br /><sub><b>wznmickey</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=wznmickey" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="12.5%"><a href="https://github.com/NicolasRoelandt"><img src="https://avatars.githubusercontent.com/u/8594193?v=4?s=100" width="100px;" alt="NicolasRoelandt"/><br /><sub><b>NicolasRoelandt</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=NicolasRoelandt" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="12.5%"><a href="https://github.com/jbouganim-parallel"><img src="https://avatars.githubusercontent.com/u/150748285?v=4?s=100" width="100px;" alt="Josh Bouganim"/><br /><sub><b>Josh Bouganim</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=jbouganim-parallel" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="12.5%"><a href="https://loshz.com"><img src="https://avatars.githubusercontent.com/u/3449337?v=4?s=100" width="100px;" alt="Dan"/><br /><sub><b>Dan</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=loshz" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
// I AM NOT DONE
|
||||
|
||||
// This function returns how much icecream there is left in the fridge.
|
||||
// If it's before 10PM, there's 5 pieces left. At 10PM, someone eats them
|
||||
// If it's before 10PM, there's 5 scoops left. At 10PM, someone eats it
|
||||
// all, so there'll be no more left :(
|
||||
fn maybe_icecream(time_of_day: u16) -> Option<u16> {
|
||||
// We use the 24-hour system here, so 10PM is a value of 22 and 12AM is a
|
||||
// value of 0 The Option output should gracefully handle cases where
|
||||
// value of 0. The Option output should gracefully handle cases where
|
||||
// time_of_day > 23.
|
||||
// TODO: Complete the function body - remember to return an Option!
|
||||
???
|
||||
|
@ -22,10 +22,11 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn check_icecream() {
|
||||
assert_eq!(maybe_icecream(0), Some(5));
|
||||
assert_eq!(maybe_icecream(9), Some(5));
|
||||
assert_eq!(maybe_icecream(10), Some(5));
|
||||
assert_eq!(maybe_icecream(23), Some(0));
|
||||
assert_eq!(maybe_icecream(18), Some(5));
|
||||
assert_eq!(maybe_icecream(22), Some(0));
|
||||
assert_eq!(maybe_icecream(23), Some(0));
|
||||
assert_eq!(maybe_icecream(25), None);
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ fn prompt_for_completion(
|
|||
if no_emoji {
|
||||
println!("\n~*~ {success_msg} ~*~\n");
|
||||
} else {
|
||||
println!("\n🎉 🎉 {success_msg} 🎉 🎉\n");
|
||||
println!("\n🎉 🎉 {success_msg} 🎉 🎉\n");
|
||||
}
|
||||
|
||||
if let Some(output) = prompt_output {
|
||||
|
|
Loading…
Reference in a new issue