Going onto a new line

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?**")

···

--
Posted via http://www.ruby-forum.com/.

print\("\*\*uh\.\.\.\.\.\*\*"\)

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

or

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

note, parens may not be needed here..

best regards -botp

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

thanks botp :slight_smile: 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

···

--
Posted via http://www.ruby-forum.com/.