From: Adam Iggy Date: 2008-08-26T09:46:06+09:00 Subject: Re: adding string and numbers Dana Merrick wrote: > Adam Iggy wrote: >> puts 'did you know there are '+name1.length+name2.length+name3.length+ ' >> letters in your name?' >> >> the problem is i get the strings combined, not adding the seperate >> numbers together. > > Try putting parentheses around the addition, like this: > > (name1.length+name2.length+name3.length).to_s > > -Dana hurray that worked! im not quite sure why it worked though? doesnt it need to be integers to add together? -- Posted via http://www.ruby-forum.com/.