going onto a new line

D

Dan L.

ok i am quite new to ruby and i am only 14 so.... any way i am
struggling to get my test to go onto a new line here is the code i put
in (if you could copy and paste the code then make the changes in the
reply that would be great):
print("**uh.....**")
sleep 1.5
print("**were am I?**")
 
B

botp

=A0 =A0 print("**uh.....**")

print "**uh.....**\n"

or

puts "**uh.....**"

note, parens may not be needed here..

best regards -botp
 
M

Marc Weber

Excerpts from Dan L.'s message of Sun Jan 30 03:06:24 +0100 2011:
ok i am quite new to ruby and i am only 14 so.... any way i am
struggling to get my test to go onto a new line here is the code i put
in (if you could copy and paste the code then make the changes in the
reply that would be great):
print("**uh.....**")
sleep 1.5
print("**were am I?**")

There are many ways. The most simple is this:

print "ath
"
print "ath
"

This will use the new line character from the source file.
However usually you use string quoting:

1.upto(10).each { |dummy| print "test\n" }

the \ gives the next character a special meaning. Here its 'n'.

Marc Weber
 
D

Dan L.

thanks botp :) works fine,

i had seen \n but
1. i did not know where to put it in the string
2. and i thought it was /n
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top