Hello everybody. I am new to Ruby and understand the bare minimum of
basic concepts. I was wondering if there was a way to take the input of
a user (supposedly a mathematical equation) and return the answer. For
example, if I started the Ruby script in my Terminal, is there a way
that I would be able to type in 1+2 and get a returned answer of 3?
Something I tried was:
puts “Enter Equation”
answervar = gets.chomp
doneans = answervar.to_i
Yet, all that did was return the first number of the equation. Any help
or advice would be greatly appreciated. Thanks!