I started to learn Ruby using IRB and wrote the wrong code below:
irb(main):001:0>"amefurashi".delete(aiueo")
I noticed it was missing a double-quote mark, and the prompt changed to:
irb(main):002:1"
I wrote the correct code:
irb(main):001:1"amefurashi".delete("aiueo")
but why won't it work?
The IRB lines that prompt you with >
are for new statements.
When the prompt says "
instead, that means you are inside a string, and IRB is expecting you to finish entering your text and close your string with another quotation mark.
It looks like what you are doing is trying to enter your statement again, before you get a new (>
) prompt.
If you are stuck in the middle of an incorrect statement and want to start over, press Ctrl-C
, then Enter
and you will get a clean >
prompt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With