Created
April 20, 2025 18:33
-
-
Save avirajkhare00/789b3cfa533bfde1326928be047cbc22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
println!("π Baking a birthday cake for your friend! π"); | |
// Ingredients for the chaos cake | |
let flour = 2.5; // cups, because precision is overrated | |
let sugar = 1.0; // cups, sweet like your friendship | |
let eggs = 3; // because 2 is too few and 4 is an omelette | |
let butter = 0.5; // cups, for that *rich* flavor | |
let chaos_level = 9001; // it's over 9000! | |
// Step 1: Mix ingredients with enthusiasm | |
println!("π₯ Throwing {} cups of flour into the bowl... *poof* cloud!", flour); | |
println!("π¬ Dumping {} cups of sugar. Hope your friend likes cavities!", sugar); | |
println!("π₯ Cracking {} eggs. Oops, shell bits add crunch!", eggs); | |
println!("π§ Slapping in {} cups of butter. Cholesterol who?", butter); | |
println!("π Adding chaos level: {}. This cake's gonna be LEGENDARY!", chaos_level); | |
// Step 2: "Bake" the cake | |
let baking_result = bake_cake(flour, sugar, eggs, butter, chaos_level); | |
// Step 3: Present the masterpiece | |
match baking_result { | |
Ok(cake) => println!("π TADA! Baked a {} cake! Happy birthday, pal!", cake), | |
Err(oops) => println!("π₯ Disaster! {}. Guess we're ordering pizza!", oops), | |
} | |
} | |
fn bake_cake(flour: f32, sugar: f32, eggs: i32, butter: f32, chaos: i32) -> Result<String, String> { | |
// Quality control... or not | |
if flour <= 0.0 || sugar <= 0.0 || eggs <= 0 || butter <= 0.0 { | |
return Err("Missing ingredients! Did you forget to rob the pantry?".to_string()); | |
} | |
if chaos > 9000 { | |
println!("π₯ Oven's screaming! Too much chaos, it's alive!"); | |
return Err("Cake turned into a sentient monster! RUN!".to_string()); | |
} | |
// Baking logic (totally legit) | |
println!("π Baking at 350Β°F for... uh, until it smells burnt!"); | |
let cake_type = if chaos > 5000 { | |
"Cosmic Chaos Chocolate".to_string() | |
} else { | |
"Vanilla Friendship Delight".to_string() | |
}; | |
Ok(cake_type) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment