How to exit / exit IRB after entering a code that requires more input / does not start immediately

A particular line of code does not exit, and the IRB exits the >> prompt. I'm not looking for an exit from the IRB, but just to exit to the state preceding the line of code that triggered the prompt >> .

 >> stop_words = %w {the a and if} >> stop_words.each{|x| stop_words << x.capitalize} quit quit quit 
  • As soon as I enter this situation, I can’t even exit the IRB shell, since the quit command does not make any changes.
  • I would like to get out of state and still have my previous variable definitions intact, so in the sample code I could call stop_words to experiment with it. Any clarification / understanding of what is happening here is appreciated.
+4
source share
1 answer

Your code is endlessly looped, so you won’t get a new prompt since it is still processing your previous command.

You can press Ctrl C to immediately abort the current command.

+3
source

All Articles