From: Peter Johnsson Date: 2008-03-25T03:11:57+09:00 Subject: Re: Beginner's question Haha! finally. After a plentyful of hours I have at last finished a working code. Completely inept and lacking of grace, I know, but still! At last it is finished. Just thought I would let you guys know since you helped me so much by providing me with code-examples and tips. I know I've thanked you once already, but anyways once again, thanks! I also read some of the advanced coding, and even though I can't understand half of it I found it pleasureable to read. It also spurs me to work harder so that one day I can (hopefully) understand it. Here is the code by the way: -------------- bottles = 99 line1 = " bottles of beer on the wall, " line2 = " bottles of beer." line3 = "Take one down and pass it around, " line4 = "bottles of beer on the wall." while bottles != 0 if bottles != 1 firstpar = bottles.to_s + line1 + bottles.to_s + line2 secpar = line3 + bottles.to_s + line4 puts firstpar bottles -= 1 puts secpar else line1["bottles"] = "bottle" line2["bottles"] = "bottle" line4["bottles"] = "no more bottles" firstpar = bottles.to_s + line1 + bottles.to_s + line2 secpar = line3 + line4 puts firstpar bottles -= 1 puts secpar end end line1 = " bottles of beer on the wall, " line2 = " bottles of beer." firstpar = "No more " + line1 + "no more " + line2 secpar = "Go to the store and buy some more, 99 bottles of beer on the wall." puts firstpar puts secpar ----- I know it's not pretty, but in time I hope it will become more graceful. :D -- Posted via http://www.ruby-forum.com/.