From 7c30983e8a3d6479fce14a97f6482ce730a8faca Mon Sep 17 00:00:00 2001 From: AnthonyMichaelTDM <68485672+AnthonyMichaelTDM@users.noreply.github.com> Date: Sun, 27 Feb 2022 20:49:25 -0800 Subject: [PATCH] added exit condition when running this as a .exe, it would close immediately after generating the maze, this is no longer the case. --- 02_Amazing/rust/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/02_Amazing/rust/src/main.rs b/02_Amazing/rust/src/main.rs index a1471a6a..7abc67cf 100644 --- a/02_Amazing/rust/src/main.rs +++ b/02_Amazing/rust/src/main.rs @@ -131,7 +131,6 @@ fn main() { if used[row][col] != 0 {break;} } } - } // Add a random exit col=rng.gen_range(0..width); @@ -163,6 +162,10 @@ fn main() { } println!("."); } + + //stops the program from ending until you give input, useful when running a compiled .exe + println!("\n\npress ENTER to exit"); + io::stdin().read_line(&mut String::new()).expect("closing"); } fn get_user_input(prompt: &str) -> usize {