0

I'm completely new to programming and im having trouble figuring out why Im getting an error when typing the following:

puts "What is your favorite number?"
number = gets.chomp
number = number.to_i + 1
puts "I suggest " + number.to_s + " as a bigger and better number"

When I run in terminal the following error appears:

Last login: Fri Jul 10 07:56:21 on ttys000
mba-3093:~ knalavadi$ 
/var/folders/cv/tm657j1d0kg68fbb1rqtrlgjlg_hrm/T/Cleanup\ At\ Startup/ruby2-458233138.705.rb.command ; exit;

What is your favorite number?
1
  • It looks like your Ruby installation is mangled somehow. Are you using the system Ruby or is using something like RVM or RBenv an option? Commented Jul 10, 2015 at 15:47

1 Answer 1

1

The code works. How are you running the script? Put it in a file like number.rb and then run it by typing ruby number.rb

Sign up to request clarification or add additional context in comments.

1 Comment

This is more of a comment than an answer. Maybe you can expand on it a little?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.