Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Windows NT Batch

(Uses 2000- and XP-specific features)

Date:08/18/05
Author:tester
URL:n/a
Comments:0
Info:n/a
Score: (2.83 in 6 votes)
:: 99 Bottles of Beer
:: for Windows 2000/XP

@echo off
setlocal enabledelayedexpansion
set bottle=bottles

for /l %%* in (99, -1, 1) do (
   set number=%%*
   if !number! EQU 1 set bottle=bottle

   echo !number! !bottle! of beer on the wall, !number! !bottle! of beer.

   set /a number=!number!-1
   if !number! EQU 1 (
      set bottle=bottle
   ) else (
      if !number! EQU 0 (
         set bottle=bottles
         set number=no more
      )
   )

   echo Take one down and pass it around, !number! !bottle! of beer on the wall.
   echo/
)

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

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
1Kang Seonghoon (Tokigun)06/24/050
2Frank-Peter Schultze09/24/050

Comments

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: