Question

I'm running the Ruby irb on a DOS environment.

I've defined a dictionary.

irb(main):001:0> stuff = {'name'=> 'Zed', 'age'=>36, 'height'=>6*12+2}

I've made a mistake in calling it

irb(main):004:0> puts stuff['age]

the ruby prompt changes to an apostrophe ' instead of the usual >

irb(main):006:1'
irb(main):007:1'

IRB doesn't work anymore.

What has happened here and how do I get the shell to function again without quitting the program?

Was it helpful?

Solution

It is waiting for the closing ',that you missed here puts stuff['age]. Use Ctrl+c to get the prompt back,that you are expecting.

See below:

2.0.0p0 :001 > stuff = {'name'=> 'Zed', 'age'=>36, 'height'=>6*12+2}
 => {"name"=>"Zed", "age"=>36, "height"=>74} 
2.0.0p0 :002 > puts stuff['age]
2.0.0p0 :003'> ^C
2.0.0p0 :003 > 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top