Here was a simple exercise that prints out the always classic bottle song as you can see below. The best part about this function is there is no bus and you can go through 9,999 bottles in about 30 seconds without the headache instead of 99 bottles in 3 hours and having nightmares afterwards ;-).
One interesting thing I learned while writing this was that when you put the integer inside the string is that you can use operators within the string to have 99 bottles with #{n} in the beginning of the song and then have 98 at the end of the string with #{n-1}.
Back to studying...

No comments:
Post a Comment