From: Rick DeNatale Date: 2009-04-27T05:01:03+09:00 Subject: Re: Newbie help, please On Sun, Apr 26, 2009 at 3:47 PM, Mike West wrote: > Hello all, > > I am a complete novice to programming. I have chosen Ruby as my first > language. > > How do you mix arithmetic(or integers) and strings together? Probably the most idiomatic way is to use string interpolation. Within a double quoted string you can put a Ruby expression in #{ } delimiters. The expression will be evaluated and to_s will be sent to the result replacing the delimited expression so: Instead of >> puts 2+4 ' is the sum of 2+4.' I would probably use: puts "#{2+4} is the sum of 2+4" and for > puts number + '?? Don\t you know that ' + better + 'is a superior selection?' puts "#{number}'?? Don\t you know that #{better} is a superior selection?" -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale