From 9d55dd5fe82b7deef190b76e87b210d5788199f5 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Thu, 23 Jan 2025 12:12:38 +0000 Subject: [PATCH] feat: ignore empty lines --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5586a51..1185e27 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,8 +9,14 @@ fn main() -> Result<()> { let mut memory: HashMap = HashMap::new(); - for instruction in buffer.lines() { - let ops: Vec = instruction? + for line in buffer.lines() { + let line = line?; + + if line.clone().trim().is_empty() { + continue; + } + + let ops: Vec = line.trim() .split_whitespace() .map(String::from) .collect();