Multiline code on IRB?

I am trying to write a multi-line small code in IRB, but it has no
option to come to the next line.

When you write a line that isn’t finished (e.g. end a line with a
semicolon) ;
or write a “do” with no “end” do
it won’t evaluate it until you finish it
end

On Tue, Nov 16, 2010 at 11:45 PM, niklas | brueckenschlaeger
[email protected] wrote:

When you write a line that isn’t finished (e.g. end a line with a
semicolon) ;
or write a “do” with no “end” do
it won’t evaluate it until you finish it
end

In all other cases you can escape the line ending the same way as in a
script:

irb(main):001:0> 5
irb(main):002:0* + 3
=> 8
irb(main):003:0>

Kind regards

robert

Excerpts from Rubist R.'s message of Tue Nov 16 14:41:27 -0800 2010:

I am trying to write a multi-line small code in IRB, but it has no
option to come to the next line.

As others have mentioned, you can use ‘;’ or escape newlines.

However a few people have hacked up scripts to combine a multiplexer
like gnu
screen, a REPL (in this case, irb) and an editor to get a somewhat
better
multiline REPL.

See attached for a very rough hacked up script that does this (it will
use vim
as your editor, and create a BufWritePost hook so that every time you
save the
buffer, the contents are copied over to IRB).