Disregard Stack Overflow's syntax highlighting in this answer. It is misleading.
The line
justin.find{|key,value|key=='phone_number
contains a beginning of a multiline string, which starts with phone_number
. Since you haven't finished it yet—by entering a second '
—IRB politely waits for you to finish the string. Entering
justin.find{|key,value|key=='phone_number'}
as the second line results in finishing the string you have started, entering a method call or local variable phone_number
and right afterwards adding a begining of yet another string, now starting with }
. At this point the code which IRB sees looks like
justin.find{|key,value|key=="phone_number\njustin.find{|key,value|key=="phone_number'}
It is not finished yet—because the last string is not terminated—so IRB waits for more input.
Each subsequent
justin.find{|key,value|key=='phone_number'}
makes you stay in this loop.
Ruby will not interrupt you and tell that there's a syntax error. The reason is that IRB operates on a per-line¹ basis and you haven't technically finished the line. Indeed, the strings in the expression have new line characters in them, but there's no newline character in the code which would cause the expression to terminate.
Now I hope that the answer to your question is obvious. In order to get IRB out of the loop enter
'
¹ Per-expression would be more precise, but per-line is satisfactory in the context of this answer.