Multiline code on IRB?

R

Rubist Rohit

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

Robert Klemme

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
=A0it 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 scri=
pt:

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

Kind regards

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top