src/main.rs aktualisiert
Had to add a better loop funktion for this situation
This commit is contained in:
parent
83737c1d36
commit
b25d48891f
13
src/main.rs
13
src/main.rs
|
@ -2,7 +2,7 @@ use std::io;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
fn main(){
|
fn main(){
|
||||||
let mut score:u32 = 0;
|
let mut score:u32 = 0;
|
||||||
loop {
|
while score < 32 {
|
||||||
println!("Vor dir sind drei Türen");
|
println!("Vor dir sind drei Türen");
|
||||||
println!("Eine von ihnen tötet dich ");
|
println!("Eine von ihnen tötet dich ");
|
||||||
println!("Durch welche gehst du?");
|
println!("Durch welche gehst du?");
|
||||||
|
@ -21,13 +21,8 @@ fn main(){
|
||||||
println!("Du hast überlebt");
|
println!("Du hast überlebt");
|
||||||
}
|
}
|
||||||
let _score = score += 1;
|
let _score = score += 1;
|
||||||
if score== 32{
|
|
||||||
win(32);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
fn win(w:i32) {
|
println!("Du hast gewonnen");
|
||||||
println!("Du hast mit {w} gewonnen");
|
|
||||||
panic!()
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue