From: Aleksey V Zapparov Date: 2012-07-09T04:35:20+09:00 Subject: Re: How to Print on a single line --Sig_/J.XeY4+orfgbtWOE0XPeeV8 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 9 Jul 2012 04:18:03 +0900 Kareem Adams wrote: > print 'Hello there, and what\'s your name? ' > name =3D gets > puts 'Your name is ' + name + '? What a lovely name!' >=20 > Please see below, this is how it prints: >=20 > Hello there, and what's your name? Kareem > Your name is Kareem > ? What a lovely name! >=20 > How do I get it to print like this: >=20 > Hello there, and what's your name? Kareem > Your name is Kareem? What a lovely name! `gets` returns string with separator (new line by default): http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-gets So you can either strip the result (but it will remove any leading/trailing whitespaces): name =3D gets.strip or simply leave everything but the last char name =3D gets[0...-1] --=20 Sincerely yours, Aleksey V. Zapparov A.K.A. ixti FSF Member #7118 Mobile Phone: +34 677 990 688 Homepage: http://www.ixti.net JID: zapparov@jabber.ru *Origin: Happy Hacking! --Sig_/J.XeY4+orfgbtWOE0XPeeV8 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJP+eDzAAoJEGRO9nGLm9Y8JSYIAMZufM5v/RP4C1LJybtOxE/l 15+wJlqx/oeFKLrIMdevg0P/JJZTqoPY+vtM9rNbgxiBuD7d/d1hBwhmaUkPsadk tPHPFogLydYczieGVm9e0W4y9/44+d768exLzPEN3kH+Xojq3CKQV0AKI/aQ6S4m oyMR+825WLpZ4bWQWjAG0Qc2YnwT5ESayPvk5g8awa4FAJW1mpmo4NhEMLVvo/pa 9D961R/MyMx+Nx5XtCn0zIsq94iaWKdZFThdxJnC0ugy4FrpEL3cmsz/x7QmYpF7 hsVNWTd2qUtEv2LIzYz0rsu0KCum33vXVNdoLoZxbMN00wfuB1cHFNBVaPOXJQw= =spUZ -----END PGP SIGNATURE----- --Sig_/J.XeY4+orfgbtWOE0XPeeV8--