irb does not print anything

ruby

Solution

What happened is that after the error, you typed `done` instead of `end`.

Nothing was executed until the block was parsed, but the `end` never came, so irb just kept reading stuff...

In the future just type ^C or ^D until you get back to the top level or the shell, and then start over.

Problem

I'm a newbie at ruby. While I am using irb, something happens.(Nothings are printed) Does anyone have any advise about this? I cannot know even what search keyword would be OK for this situation. (maybe an environment-specific problem? How do you think?) ``` irb(main):010:0> a = [3,2,1] => [3, 2, 1] irb(main):011:0> a.each => #<Enumerable::Enumerator:0x7f413a20d668> irb(main):012:0> a.each{|x| print x} 321=> [3, 2, 1] irb(main):013:0> a.each do |x| print x end 321=> [3, 2, 1] irb(main):014:0> 1.to 9 NoMethodError: undefined method `to' for 1:Fixnum from (irb):14 from :0 irb(main):015:0> 1.to(9) do |x| print x done irb(main):016:1> 1.to(9) { |x| print x } irb(main):017:1> 1.to(9) irb(main):018:1> 1.upto(9) irb(main):019:1> 1.upto(9) do |x| print x done irb(main):020:2> 1.upto(9) { |x| print x } irb(main):021:2> print "x" irb(main):022:2> abc irb(main):023:2> a irb(main):024:2> b ```

Original source