1

For some reason when I run:

name = gets.chomp

puts name

I get the error:

gets:1:in <main>': undefined methodchomp' for nil:NilClass (NoMethodError)

If I remove the .chomp and run:

name = gets

puts name

I get no prompt or error, the console just gives me the finished time. What am I doing wrong?

By the way I'm using Sublime, configured with Ruby

  • possible duplicate of [Trying to run a simple gets.chomp in Sublime](http://stackoverflow.com/questions/15086154/trying-to-run-a-simple-gets-chomp-in-sublime) – knut Jun 02 '13 at 20:55

1 Answers1

0

You can try run this file in Terminal. Like this:

ruby test.rb

... #puts name ...

If it runs well, it means your problem is another situation. You can goto Sublime Text 2 Launch ruby file in terminal

Community
  • 1
  • 1
staticor
  • 620
  • 9
  • 19