feat(errors): completed errors

This commit is contained in:
2026-09-06 22:26:34 +02:00
parent ad542a4892
commit fe01747f82
6 changed files with 16 additions and 8 deletions
+3 -1
View File
@@ -15,7 +15,7 @@ fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> {
// TODO: Fix the compiler error by changing the signature and body of the
// `main` function.
fn main() {
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut tokens = 100;
let pretend_user_input = "8";
@@ -24,8 +24,10 @@ fn main() {
if cost > tokens {
println!("You can't afford that many!");
Ok(())
} else {
tokens -= cost;
println!("You now have {tokens} tokens.");
Ok(())
}
}