feat: ignore empty lines

This commit is contained in:
Muhammad Nauman Raza 2025-01-23 12:12:38 +00:00
parent 23f3f0b070
commit 9d55dd5fe8
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -9,8 +9,14 @@ fn main() -> Result<()> {
let mut memory: HashMap<String, i64> = HashMap::new(); let mut memory: HashMap<String, i64> = HashMap::new();
for instruction in buffer.lines() { for line in buffer.lines() {
let ops: Vec<String> = instruction? let line = line?;
if line.clone().trim().is_empty() {
continue;
}
let ops: Vec<String> = line.trim()
.split_whitespace() .split_whitespace()
.map(String::from) .map(String::from)
.collect(); .collect();