From: Kirk Haines Date: 2012-07-09T04:26:15+09:00 Subject: Re: How to Print on a single line On Sun, Jul 8, 2012 at 1:18 PM, Kareem Adams wrote: > Hi there, > > How do I get the below script to print the 2nd part on a single line? > > print 'Hello there, and what\'s your name? ' > name = gets > puts 'Your name is ' + name + '? What a lovely name!' > > > Please see below, this is how it prints: > > Hello there, and what's your name? Kareem > Your name is Kareem > ? What a lovely name! > > How do I get it to print like this: > > Hello there, and what's your name? Kareem > Your name is Kareem? What a lovely name!' name = gets.chomp String#chomp removes the record separator (newline) at the end of the string, if there is one. http://ruby-doc.org/core-1.9.3/String.html#method-i-chomp Kirk Haines