diff --git a/src/main.rs b/src/main.rs index 8c48057..167dde8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,8 +27,8 @@ impl Calc { self.display(); } fn eval(&mut self) { - let left = self.left.parse::().unwrap(); - let right = self.right.parse::().unwrap(); + let left = self.left.parse::().unwrap_or(0); + let right = self.right.parse::().unwrap_or(0); let ans = match self.operator { Some(Operators::PLUS) => left + right, Some(Operators::MINUS) => left - right,