diff --git a/src/main.rs b/src/main.rs index 1861c880793259018ce75c90db3a9efd56d6ab80..d8dc771684d659cec43cfd6b02f9bf521dbdf9c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,13 +39,15 @@ fn main() { Ordering::Equal => { println!("You win!"); println!("Total number of attempts: {}", tries_counter); - println!("First print:"); - for x in attempt_history.iter() { - println!("{:?}", x); - } - println!("\nSecond print:"); - for x in attempt_history.iter() { + println!("Last entry first, maximum 3:"); + for (i, x) in attempt_history.iter().rev().enumerate() { println!("{:?}", x); + // Only print the 3 last (see .rev() above) + if i >= 2 { + break; + } + + } break; }