From: Eero Saynatkari Date: 2006-10-18T11:13:31+09:00 Subject: Re: Newbie: Ruby and Writing Variables In Strings --nbhonbzV/xpXxmuC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2006.10.18 10:06, James Edward Gray II wrote: > On Oct 17, 2006, at 7:59 PM, Lovell Mcilwain wrote: >=20 > >The snipet of code its referring to is: > > > >puts number + ' bottles of beer on the wall, ' number + ' bottles of > >beer. Take one down pass it around' >=20 > You are missing a plus in the above line. You need one right before =20 > the second `number` to join it into the string. >=20 > When you get that far, you will run into a new error (assuming =20 > `number` is actually numeric). ;) >=20 > You need to convert numbers to put them in strings. You can do this =20 > with the to_s method available to all numbers: >=20 > puts '1 + 2 =3D' + 3.to_s Or =20 puts "1 + 2 =3D #{3}" To avoid having to #to_s everything manually. --nbhonbzV/xpXxmuC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFNY047Nh7RM4TrhIRAlQnAKCtpHM59w+Jn15xiLFNk9H/wuDeLwCfZD/5 /SFwH/4Iet93hYO4zX4HgkY= =pjTr -----END PGP SIGNATURE----- --nbhonbzV/xpXxmuC--