From b25d48891ffe09c7a75acdf36d93df8a59e5a299 Mon Sep 17 00:00:00 2001 From: robin Date: Mon, 8 Apr 2024 20:24:31 +0200 Subject: [PATCH] src/main.rs aktualisiert Had to add a better loop funktion for this situation --- src/main.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index fb58ab0..99c1c18 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use std::io; use rand::Rng; fn main(){ let mut score:u32 = 0; - loop { + while score < 32 { println!("Vor dir sind drei Türen"); println!("Eine von ihnen tötet dich "); println!("Durch welche gehst du?"); @@ -21,13 +21,8 @@ fn main(){ println!("Du hast überlebt"); } let _score = score += 1; - if score== 32{ - win(32); - } - } -} -fn win(w:i32) { - println!("Du hast mit {w} gewonnen"); - panic!() + } + println!("Du hast gewonnen"); + } \ No newline at end of file