Hi

user_input = $stdin.gets.chomp

Now the user types:

"5 + 5"

As string (without the quotes).

user_input is now a string object containing "5 + 5"

I would like to give back the result of the operation, which should be
10.

Right now I use eval() and it works, but I am wondering if there is a
better alternative for it? How does IRB solve this?

-- 
Posted via http://www.ruby-forum.com/.