latest pushes

This commit is contained in:
2024-10-05 11:54:36 -04:00
parent 482ffe0604
commit b0a2610d70
8 changed files with 43 additions and 123 deletions

View File

@@ -222,7 +222,7 @@ impl Interpreter {
let a = self.get_var_value(tokens[0])?;
let b = self.get_var_value(tokens[2])?;
match tokens[1] {
let result = match tokens[1] {
"+" => Ok(a + b),
"-" => Ok(a - b),
"*" => Ok(a * b),
@@ -241,7 +241,9 @@ impl Interpreter {
}
}
_ => Err(format!("Unsupported operation: {}", tokens[1])),
}
};
result
} else {
Err("Invalid arithmetic expression".to_string())
}