mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
add solutions for panic.md
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user