Question

I am just picking up ruby and wanted to input a command into terminal put pushed the return key by accident before line was not finished.

irb(main):007:0> mixed = {1 => ['a', 'b', 'c'], 
irb(main):008:1* 

of course now i get "stuck" in the 008.1 of the irb...

How do I go back and edit the code?

Was it helpful?

Solution

2 things I can think of off the bat: finish entering the code on the next line, or hit ctl-c and start over.

OTHER TIPS

Ruby is generally flexible regarding newlines appearing in your code. In your case you can continue your code on the next line (and eventually end it with }).

If you would rather correct the line, either give it the input it's waiting for (} in your case) and get a syntax error or press ctrl+c to interrupt. After doing so, you can press to edit the line and fix the mistake you made.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top