From 7372730119199c9c3ae39899614cb6c1f5de2655 Mon Sep 17 00:00:00 2001 From: mynameisdeleted Date: Thu, 9 Jul 2026 18:07:08 -0400 Subject: [PATCH] feat(main): enhance demonstration of linked list operations with count tracking --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 751ef86..e7cefcc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,14 +41,22 @@ impl LinkedList { fn main() { let mut list = LinkedList::new(); + let mut count = 0; + let message1 = "hello world"; // Demonstrate pushing items list.push_front(10); + count += 1; list.push_front(20); + count += 1; list.push_front(30); + count += 1; - // Demonstrate peaking at the top item - println!("Top element: {:?}", list.peek_front()); // Output: Some(30) + // Demonstrate peeking at the top item + if let Some(top) = list.peek_front() { + println!("Top element: {}\ncount: {}", top, count); // Output: 30 + } + println!("{}", message1); // Demonstrate popping items while let Some(value) = list.pop_front() {