mirror of
https://github.com/ahgamut/rust-ape-example.git
synced 2024-05-15 10:02:42 +00:00
20 lines
318 B
Rust
20 lines
318 B
Rust
// ./src/error/panic.md
|
|
|
|
|
|
fn drink(beverage: &str) {
|
|
// You shouldn't drink too much sugary beverages.
|
|
if beverage == "lemonade" { panic!("AAAaaaaa!!!!"); }
|
|
|
|
println!("Some refreshing {} is all I need.", beverage);
|
|
}
|
|
|
|
fn part0() {
|
|
drink("water");
|
|
drink("lemonade");
|
|
}
|
|
|
|
pub fn main() {
|
|
part0();
|
|
}
|
|
|