Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Code Golf: 99 Bottles of Beer on the Wall

DZone's Guide to

Code Golf: 99 Bottles of Beer on the Wall

· Cloud Zone
Free Resource

Deploy and scale data-rich applications in minutes and with ease. Mesosphere DC/OS includes everything you need to elastically run containerized apps and data services in production.

When it comes to ingenuity, Code Golf is my absolute favorite thing in the developer space. Code Golf, like the game of golf, is an exercise in brevity - the fewest lines of code and the smaller the file size, the better. It requires creativity, knowledge of your craft, and perseverance.

So in order to showcase the brightest members of our community, DZone will be holding a weekly Code Golf competition.

What's in it for you? The winner every week will receive some awesome DZone swag!

In order to submit your entry, you'll need to leave a comment with your code (using the code feature), as well as what language you used. Your code must be completely self-contained (don't reference code external to your own!).

So, let's get started!

This week's challenge:

You'll need to output all of the classic "99 Bottles of Beer on the Wall". Your output should look just like this:

99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.

...

1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.

No more bottles of beer on the wall, no more bottles of beer. 
Go to the store and buy some more, 99 bottles of beer on the wall.

The code with the fewest characters (excluding whitespace) will be the winner! You must submit your code by Tuesday, March 3rd. The winner will be announced in our Newsletter!

Sound like something you can handle? We'd like to see you try.

Happy coding!

Discover new technologies simplifying running containers and data services in production with this free eBook by O'Reilly. Courtesy of Mesosphere.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}