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 Turing

(Ontario's default high school language)

Date:03/21/06
Author:Bill Huang
URL:n/a
Comments:4
Info:n/a
Score: (1.56 in 9 votes)
%  Bill Huang huan3816@email.adsb.on.ca
%  Turing language version of 99 bottles of beer
loop
    for decreasing i : 99 .. 1
        put i, " bottle(s) of beer on the wall, ", i, " bottle(s) of beer"
        put "Take one down, pass it around, ", i - 1,
            " bottle(s) of beer on the wall"
            delay (300)
    end for
    put "No more bottles of beer on the wall, no more bottles of beer."
    put "Go to the store and buy some more, 99 bottles of beer on the wall."
    delay (2000)
end loop

Download Source | Write Comment

Alternative Versions

Comments

>>  Karan Bhangui said on 06/11/08 02:26:21

Karan Bhangui for decreasing bottles : 99 .. 0
if (bottles >= 2) then
put bottles, " bottles of beer on the wall, ", bottles, " bottles of beer."
if (bottles not= 2) then
put "Take one down and pass it around, ", (bottles - 1), " bottles of beer on the wall.\n"
else
put "Take one down and pass it around, 1 bottle of beer on the wall.\n"
end if
elsif (bottles = 1) then
put "1 bottle of beer on the wall, 1 bottle of beer."
put "Take one down and pass it around, no more bottles of beer on the wall.\n"
else
put "No more bottles of beer on the wall, no more bottles of beer."
put "Go to the store and buy some more, 99 bottles of beer on the wall."
end if
end for

>>  Lucas said on 03/29/10 06:46:09

Lucas This code sucks. It's a infinite loop.

>>  barrym said on 03/29/10 08:45:49

barrym More lazy-ass "bottle(s)" code. C'mon Bill, give us a conditional
expression or two. Geez Louise..........

>>  Rugxulo said on 09/26/10 09:26:44

Rugxulo Oh, so now barrym has to whine about Bill, too? (Man, is he a broken record or what??)

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: