bin/maths in maths-0.0.2 vs bin/maths in maths-0.0.3
- old
+ new
@@ -30,10 +30,14 @@
puts
else
begin
result = parser.parse(command)
- if result.frac == 0
+ if result.nil?
+ output = "Undefined"
+ elsif !result.is_a?(Numeric)
+ output = result.to_s
+ elsif result.frac == 0
output = result.to_i.to_s
else
output = result.to_s("F")
end
puts "= #{output}"
\ No newline at end of file