Hi Lovell,

For your example,

> puts number + ' bottles of beer on the wall, ' number + ' bottles of
> beer. Take one down pass it around'

try this instead:

puts number + ' bottles of beer on the wall, ' + number + ' bottles of
beer. Take one down pass it around'

Note the '+ number +' at the second variable call.


best, George


Lovell Mcilwain wrote:
> Hello all,
>
> As I am going through my ruby book (Trying to learn Ruby of course) on
> how to use flow control, one of the exercises is to create a program
> that sings "99 bottles of beer on the wall"
>
> I have started to create this program and I am at the point where I want
> to test what I have done so far (code is not finished). When I try to
> run my code, I get the following error:
>
> 99bottles.rb:10: syntax error, unexpected tIDENTIFIER, expecting kEND
> puts number + ' bottles of beer on the wall, ' number + ' bottles of
> beer. Take
>                                                      ^
>  one down pass it around'
>
>
> 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'
>
> My first thought is that my spacing between the variable "number" and
> the "+" sign are screwing things up but I can't seem how since to me
> that clearly looks OK.
>
> It could also be that I just don't understand how to properly right a
> variable into a string, but to me that also looks right ( I even tried
> it with the .to_s and still nothing).
>
> Can anyone help me understand what I am doing wrong?
> 
> -- 
> Posted via http://www.ruby-forum.com/.