Skip to content

Commit 099a5be

Browse files
added exit condition
when running this as a .exe, it would close immediately after generating the maze, this is no longer the case.
1 parent 020fb62 commit 099a5be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

02_Amazing/rust/src/main.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ fn main() {
131131
if used[row][col] != 0 {break;}
132132
}
133133
}
134-
135134
}
136135
// Add a random exit
137136
col=rng.gen_range(0..width);
@@ -163,6 +162,10 @@ fn main() {
163162
}
164163
println!(".");
165164
}
165+
166+
//stops the program from ending until you give input, useful when running a compiled .exe
167+
println!("\n\npress ENTER to exit");
168+
io::stdin().read_line(&mut String::new()).expect("closing");
166169
}
167170

168171
fn get_user_input(prompt: &str) -> usize {

0 commit comments

Comments
 (0)