add solutions for panic.md

This commit is contained in:
sunface
2022-03-10 16:22:33 +08:00
parent 9ae41d2c39
commit 29cc9e92c3

View File

@ -1,3 +1,23 @@
1.
```rust
use core::panic;
fn drink(beverage: &str) {
if beverage == "lemonade" {
println!("Success!");
// IMPLEMENT the below code
panic!("drinked, duang.....peng!")
}
println!("Excercise Failed if printing out this line!");
}
fn main() {
drink("lemonade");
println!("Excercise Failed if printing out this line!");
}
```
2.
```rust