Submit new example Change log History Links Tip: internet.ls-la.net Thanks, Oliver Guestbook | ||||||||||||||||||||||||||
Choose languages starting with letter: | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0-9 | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
IBasic IBM/3x0 Assembler Icon IDL IGOR IJVM ILE Illgol IMP77 Impacto Inform 6 Inform Inger InstallScript INTERCAL Io io IRCII Irie Pascal ISETL ISM/SML IT ITCL Shell | ||||||||||||||||||||||||||
Programming language: IBasic | ||||||||||||||||||||||||||
REM IBasic version of 99 Bottles of beer (Bottles.iba) REM See http://www.pyxia.com/ibasic.html REM Philipp Winterberg, http://www.winterbergs.de OPENCONSOLE FOR B = 99 TO 1 #-1 PRINT B, " bottle(s) of beer on the wall," PRINT B, " bottle(s) of beer." PRINT "Take one down, pass it around," PRINT B-1, " bottle(s) of beer on the wall." + chr$(13) + chr$(10) NEXT B INPUT B CLOSECONSOLE | ||||||||||||||||||||||||||
Programming language: IBM/3x0 Assembler | ||||||||||||||||||||||||||
This one is in IBM 360/370/390 assembler, and is known to assemble under HLASM/390. Identifiers start in column 1, opcodes/instructions in column 10, and operands in column 16, with continuation characters in column 72 when needed. Isn't emulating punched cards fun? BEER CSECT * Standard entry linkage. STM 14,12,12(13) LR 12,15 USING BEER,12 LA 14,BEERSV ST 13,4(,14) ST 14,8(,13) LR 13,14 * The meat of the thing. OPEN (BEERDCB,(OUTPUT)) MOREBEER CP BOTTLES,=P'0' BE NOBEER MVC LINE1(4),=X'40202120' MVC LINE2(4),=X'40202120' MVC LINE5(4),=X'40202120' ED LINE1(4),BOTTLES ED LINE2(4),BOTTLES MVI LINE1,C'0' PUT BEERDCB,LINE1 PUT BEERDCB,LINE2 PUT BEERDCB,LINE3 PUT BEERDCB,LINE4 SP BOTTLES,=P'1' ED LINE5(4),BOTTLES PUT BEERDCB,LINE5 B MOREBEER NOBEER DS 0H CLOSE (BEERDCB) * Standard exit linkage. L 13,4(,13) LM 14,12,12(13) XR 15,15 BR 14 LTORG BEERSV DC 18F'0' BOTTLES DC PL2'99' LINE1 DC CL132' bottles of beer on the wall,' LINE2 DC CL132' bottles of beer!' LINE3 DC CL132' Take one down,' LINE4 DC CL132' Pass it around,' LINE5 DC CL132' bottles of beer on the wall!' BEERDCB DCB DDNAME=BEEROUT, X DSORG=PS, X RECFM=FA, X MACRF=PM, X LRECL=132 END BEER | ||||||||||||||||||||||||||
Programming language: Icon | ||||||||||||||||||||||||||
# Scott E Gilbert <scott@cs.arizona.edu> procedure main() t:= table("bottles") t[1]:= "bottle" every n:= 100 to 1 by -1 do { write(n, " ", t[n], " of beer on the wall.\n", n, " ", t[n], " of beer.\n", "Take one down, Pass it around.\n", n-1, " ", t[n-1], " of beer on the wall.\n" ) } end | ||||||||||||||||||||||||||
Programming language: IDL | ||||||||||||||||||||||||||
; The Bottles of Beer song (c) 1996 Eric Korpela (korpela@ssl.berkeley.edu) ; USAGE: BOTTLES or BOTTLES, NUMBER ; pro bottles, number ; if not(keyword_set(number)) then begin number=99 print,'BOTTLES: Defaulting to 99 bottles!' endif ; ; Set up our song structure............ st1=replicate({n0:0,s1:' bottles of beer on the wall.', $ n1:0,s2:' bottles of beer.', $ s3:'You take one down and pass it around.', $ n2:0,s4:' bottles of beer on the wall.'}, number) ; ; put in the appropriate numbers i=(number-1)-indgen(number) st1(*).n0=i+1 st1(*).n1=i+1 st1(*).n2=i ; print,st1,format='(i3,a/i3,a/a/i3,a//)' ; | ||||||||||||||||||||||||||
Programming language: IGOR | ||||||||||||||||||||||||||
// IGOR version of: 99 Bottles of Beer // IGOR PRO is a graphing and numerical analysis environment by WaveMetrics, Inc. // http://www.wavemetrics.com/ // // Kenneth A. Goldberg, http://goldberg.lbl.gov // Proc beer(count) variable count variable i=count do if (i > 1) print, i, "Bottles of beer on the wall, ",i, " Bottles of beer" else print, i, "Bottle of beer on the wall, ",i, " Bottle of beer" endif print, i -= 1 // increment our loop variable if (i > 1) print, "Take one down pass it around, ", i, "Bottles of beer on the wall" else if (i == 1) print, "Take one down pass it around, 1 Bottle of beer on the wall" else print, "Take one down pass it around, NO MORE botles of beer on the wall" endif endif while(i > 0) print, "Go to the store and buy some more." End | ||||||||||||||||||||||||||
Programming language: IJVM | ||||||||||||||||||||||||||
// Bottles of beer on the wall in IJVM, as defined in // _Structured Computer Organization_, 4th edition. IJVM tools are // found at http://www.ontko.com/mic1/ and // http://onegeek.org/~tom/software/ijvm/. // // By Tom Rothamel <tom-ijvm@onegeek.org> .constant objref 42 .end-constant .main .var i .end-var // Store 99 in i. BIPUSH 99 ISTORE i // This loop is executed 99 times, and is terminated at the // bottom when i falls to 0. mainloop: /// <i> bottles of beer LDC_W OBJREF ILOAD i INVOKEVIRTUAL printbottlesob POP /// on the wall, BIPUSH 0x20 OUT BIPUSH 0x6F OUT BIPUSH 0x6E OUT BIPUSH 0x20 OUT BIPUSH 0x74 OUT BIPUSH 0x68 OUT BIPUSH 0x65 OUT BIPUSH 0x20 OUT BIPUSH 0x77 OUT BIPUSH 0x61 OUT BIPUSH 0x6C OUT BIPUSH 0x6C OUT BIPUSH 0x2C OUT BIPUSH 0xA OUT /// <i> bottles of beer LDC_W OBJREF ILOAD i INVOKEVIRTUAL printbottlesob POP /// . BIPUSH 0x2E OUT BIPUSH 0xA OUT // i = i - 1; IINC i -1 /// Take one down, pass it around, BIPUSH 0x54 OUT BIPUSH 0x61 OUT BIPUSH 0x6B OUT BIPUSH 0x65 OUT BIPUSH 0x20 OUT BIPUSH 0x6F OUT BIPUSH 0x6E OUT BIPUSH 0x65 OUT BIPUSH 0x20 OUT BIPUSH 0x64 OUT BIPUSH 0x6F OUT BIPUSH 0x77 OUT BIPUSH 0x6E OUT BIPUSH 0x2C OUT BIPUSH 0x20 OUT BIPUSH 0x70 OUT BIPUSH 0x61 OUT BIPUSH 0x73 OUT BIPUSH 0x73 OUT BIPUSH 0x20 OUT BIPUSH 0x69 OUT BIPUSH 0x74 OUT BIPUSH 0x20 OUT BIPUSH 0x61 OUT BIPUSH 0x72 OUT BIPUSH 0x6F OUT BIPUSH 0x75 OUT BIPUSH 0x6E OUT BIPUSH 0x64 OUT BIPUSH 0x2C OUT BIPUSH 0xA OUT /// <i> bottles of beer LDC_W OBJREF ILOAD i INVOKEVIRTUAL printbottlesob POP /// on the wall. BIPUSH 0x20 OUT BIPUSH 0x6F OUT BIPUSH 0x6E OUT BIPUSH 0x20 OUT BIPUSH 0x74 OUT BIPUSH 0x68 OUT BIPUSH 0x65 OUT BIPUSH 0x20 OUT BIPUSH 0x77 OUT BIPUSH 0x61 OUT BIPUSH 0x6C OUT BIPUSH 0x6C OUT BIPUSH 0x2E OUT BIPUSH 0xA OUT BIPUSH 0xA OUT // If i reaches zero, we're done. ILOAD i IFEQ done // Else, repeat. GOTO mainloop done: HALT .end-main // This is responsible for printing the '<n> bottles of beer' strings // seen above. It also properly handles printing 'No' for the case // where n == 0 and the removal of pluralization for n == 1. .method printbottlesob(n) .var q oldn .end-var // oldn = n ILOAD n ISTORE oldn // See if n == 0. ILOAD n IFEQ zero // Otherwise, we have a real number and need to divide to convert // it to decimal. BIPUSH 0x0 ISTORE q // We do that by looping up to 9 times. Sucks, but what the hey. divide_loop: // Bail if n is less than 10. ILOAD n BIPUSH 0xA ISUB IFLT divide_done // Subtract ten from n, add one to the quotient. IINC n -10 IINC q 1 GOTO divide_loop divide_done: // Now, we have the first digit of the decimal number in q and the // second is left in n. // if q is zero, skip printing the first digit. ILOAD q IFEQ q_is_zero // print the first digit. BIPUSH 0x30 ILOAD q IADD OUT q_is_zero: // Print the second digit. ILOAD n BIPUSH 0x30 IADD OUT GOTO number_done zero: // If we made it here, n == 0. So, instead of printing out '0', // we print out 'No'. BIPUSH 0x4E OUT BIPUSH 0x6F OUT number_done: // print out ' bottle' in any case. BIPUSH 0x20 OUT BIPUSH 0x62 OUT BIPUSH 0x6F OUT BIPUSH 0x74 OUT BIPUSH 0x74 OUT BIPUSH 0x6C OUT BIPUSH 0x65 OUT // If oldn == 1, we skip printing out the plural 's', otherwise // we print it out. BIPUSH 0x1 ILOAD oldn IF_ICMPEQ singular BIPUSH 0x73 OUT singular: // We then print out ' of beer' in any case. BIPUSH 0x20 OUT BIPUSH 0x6F OUT BIPUSH 0x66 OUT BIPUSH 0x20 OUT BIPUSH 0x62 OUT BIPUSH 0x65 OUT BIPUSH 0x65 OUT BIPUSH 0x72 OUT // We return zero, since we have to return something. BIPUSH 0x0 IRETURN /// } .end-method | ||||||||||||||||||||||||||
Programming language: ILE | ||||||||||||||||||||||||||
This is IBM's next generation of RPG. H* H* ILE RPG/400 - 99 Bottles of Beer on the Wall. H* (IBM AS/400 Midrange Platform) H* (Program Source BOTTLESR1) H* FBottlesS1 O E WorkStn C C Z-Add *HIVAL Bottles1 C C DoW Bottles1 > *Zero C Eval Bottles2 = Bottles1 C Write #Display C Sub 1 Bottles1 C EndDo C C Eval *InLR = *On C ----------------------- A* A* ILE RPG/400 - 99 Bottles of Beer on the Wall. A* (IBM AS/400 Midrange Platform) A* (Display File Source BOTTLESS1) A* A DSPSIZ(24 80 *DS3) A R #DISPLAY FRCDTA A A BOTTLES1 2Y 0O 4 2EDTCDE(4) A 4 5'Bottles of Beer On the Wall,' A BOTTLES2 2Y 0O 4 34EDTCDE(4) A 4 37'Bottles of Beer,' A 5 2'Take one down, pass it around.' A | ||||||||||||||||||||||||||
Programming language: Illgol | ||||||||||||||||||||||||||
*p={if#0>0print(stu#0)else print"No more";print" bottle";if#0<>1print"s"; print" of beer"};*i=0;for i=0to 98{do p(99-i);print" on the wall,",EoL;do p(99-i);print".",EoL;print"Take one down, pass it around,",EoL;do p(98-i);print".",EoL,EoL;} FIN | ||||||||||||||||||||||||||
Programming language: IMP77 | ||||||||||||||||||||||||||
This is the language IMP77 which is a version of IMP from Edinburgh University. (IMP is a somewhat modernised version of Atlas Autocode, one of the earliest programming languages from the 50's) Edinburgh had another language from the mid 70's called HAL (High-Level Assembler) which was an assembler with high-level programming construct support and advanced macros; generally programs in it looked more like a programming language than an assembler. There is a *different* language called IMP which is the one that used to be used by the NSA. They're not similar. %begin; ! This is the Edinburgh programming language IMP %routine beer me(%integer bottles) %string (255) glass = "" ! avoiding use of standard library int->str conversion for no good reason. %if bottles > 9 %then glass = to string(bottles//10+'0') glass <- glass.to string(bottles - bottles // 10 * 10 + '0') glass = "No more" %if glass = "0" {string compare} glass <- glass." bottle" glass <- glass."s" %if bottles \= 1 glass <- glass." of beer" print string(glass." on the wall".snl) %return %if bottles = 0 print string(glass.snl) print string("Take one down, pass it around,".snl) beer me(bottles - 1) {gratuitously recursive, but compiler will fix it!} %end %cycle beer me(99) print string("Go to the store and buy some more,".snl) %repeat %end %of %programme | ||||||||||||||||||||||||||
Programming language: Impacto | ||||||||||||||||||||||||||
\ Impacto version of 99 Bottles of beer (Bottles.imp) \ Philipp Winterberg, http://www.winterbergs.de \ See http://scorpius.spaceports.com/~esanto/ for(b = 1, 99, 1) { print(100-b " bottle(s) of beer on the wall,\n") print(100-b " bottle(s) of beer.\n") print("Take one down, pass it around,\n") print(99-b " bottle(s) of beer on the wall.\n\n") } end() | ||||||||||||||||||||||||||
Programming language: Inform 6 | ||||||||||||||||||||||||||
Inform 6 is version 6 of a compiler meant for writing adventure games for the so-called "Z-machine" created by Infocom. It seems to be more object oriented than the original sent to me. <a href=http://www.doggysoft.co.uk/inform>Click here</a> for more information. ! ----------------------------------------------------------------------------- ! 99 Bottles of Beer on the Wall, Inform 6 version. ! ! Torbjörn Andersson, (d91tan@Student.DoCS.UU.SE), August 1997 ! ----------------------------------------------------------------------------- Constant NUM_BOTTLES 99; Object wall private bottles_left, with init [ n; self.bottles_left = n; ], bottle_name [; if (self.bottles_left == 1) return "bottle"; return "bottles"; ], bottle_count [; return self.bottles_left; ], take_one_down [; self.bottles_left--; ]; [ Main; wall.init(NUM_BOTTLES); while (wall.bottle_count() > 0) { print "^", wall.bottle_count(), " ", (string) wall.bottle_name(), " of beer on the wall,^ ", wall.bottle_count(), " ", (string) wall.bottle_name(), " of beer^You take one down and pass it around^ "; wall.take_one_down(); if (wall.bottle_count() == 0) print "No more"; else print wall.bottle_count(); print " ", (string) wall.bottle_name(), " of beer on the wall.^"; } ]; | ||||||||||||||||||||||||||
Programming language: Inform | ||||||||||||||||||||||||||
Inform is a compiler meant for writing adventure games for the so-called "Z-machine" created by Infocom. <a href=http://www.doggysoft.co.uk/inform>Click here</a> for more information. ! --------------------------------------------------------------------------- ! 99 Bottles of Beer on the Wall, Inform version [smaller] ! _ ! Torbjorn Andersson, (d91tan@Minsk.DoCS.UU.SE) December 1995 ! --------------------------------------------------------------------------- ! For technical reasons, the first function is not allowed to use local ! variables. Global i = 99; [ Main; print "^^^^"; while (i > 0) { new_line; print i, (char) ' ', (PluralBottle) i, " of beer on the wall,^"; print (Chorus) i--; print "You take one down & pass it around^"; print (Chorus) i; } @read_char 1 i; quit; ]; [ PluralBottle n; if (n == 1) print "bottle"; else print "bottles"; ]; [ Chorus n; print " "; if (n == 0) print "No more"; else print n; print_ret (char) ' ', (PluralBottle) n, " of beer"; ]; end; | ||||||||||||||||||||||||||
Programming language: Inger | ||||||||||||||||||||||||||
/* * 99 bottles of beer in Inger * (http://inger.sourceforge.net) * * by Alex van Oostenrijk: atrox [@] zebra [.] uem [.] mz * */ module bottles; #include "stdio.ih" void say: int bottles -> void { switch( bottles ) { case 0 { printf( "No more bottles" ); } case 1 { printf( "One bottle" ); } default { printf( bottles ); printf( "bottles" ); } } } start beer: void -> void { int bottles = 99; while( bottles > 0 ) do { say( bottles ); printf( " of beer on the wall,\n" ); say( bottles ); printf( " of beeeeer . . .,\n" ); printf( "Take one down, pass it around,\n" ); bottles = bottles - 1; say( bottles ); printf( " of beer on the wall,\n" ); say( bottles ); printf( " of beeeeer . . .,\n\n" ); } printf( "\nTime to buy more beer!\n" ); } | ||||||||||||||||||||||||||
Programming language: InstallScript | ||||||||||||||||||||||||||
/************************************************************ 99 Bottles of Beer in InstallScript (c) 2003 Andrew Rich / Project Insomnia Released under GPL for http://99-bottles-of-beer.ls-la.net/ Requires: InstallShield Professional 5 or greater *************************************************************/ #include "ifx.h" NUMBER nBottles; STRING szTitle, szStatus, szTitleS, szStatusS; program Disable ( BACKGROUND ); Enable ( STATUSDLG ); for nBottles = 99 downto 0 switch ( nBottles ) case 1: szTitleS = ""; szStatusS = "s"; default: szTitleS = "s"; switch ( nBottles ) case 2: szStatusS = ""; default: szStatusS = "s"; endswitch; endswitch; Sprintf ( szTitle, "%d bottle%s of beer on the wall, %d bottle%s of beer", nBottles, szTitleS, nBottles, szTitleS ); if ( nBottles ) then Sprintf ( szStatus, "Take one down, pass it around, %d bottle%s of beer on the wall.", nBottles - 1, szStatusS ); else szStatus = ""; endif; SetDialogTitle ( DLG_STATUS, szTitle ); SetStatusWindow ( nBottles, szStatus ); Delay ( 1 ); endfor; Disable ( STATUSDLG ); endprogram | ||||||||||||||||||||||||||
Programming language: INTERCAL | ||||||||||||||||||||||||||
INTERCAL is a real language, apparently created with the notion that programming ought to be hard. Program courtesy Matt Dimeo. PLEASE DO ,10 <- #1 PLEASE DO ,10SUB#1 <- #176 PLEASE DO ,11 <- #30 PLEASE DO ,11SUB#1 <- #76 DO ,11SUB#2 <- #190 DO ,11SUB#3 <- #80 DO ,11SUB#4 <- #200 PLEASE DO ,11SUB#5 <- #256 DO ,11SUB#6 <- #248 DO ,11SUB#7 <- #144 DO ,11SUB#8 <- #216 PLEASE DO ,11SUB#9 <- #202 DO ,11SUB#10 <- #14 DO ,11SUB#11 <- #144 DO ,11SUB#12 <- #98 PLEASE DO ,11SUB#13 <- #190 DO ,11SUB#14 <- #160 DO ,11SUB#15 <- #256 DO ,11SUB#16 <- #88 PLEASE DO ,11SUB#17 <- #74 DO ,11SUB#18 <- #14 DO ,11SUB#19 <- #128 DO ,11SUB#20 <- #114 PLEASE DO ,11SUB#21 <- #214 DO ,11SUB#22 <- #24 DO ,11SUB#23 <- #112 DO ,11SUB#24 <- #162 PLEASE DO ,11SUB#25 <- #22 DO ,11SUB#26 <- #104 DO ,11SUB#27 <- #80 DO ,11SUB#28 <- #256 PLEASE DO ,11SUB#29 <- #2 DO ,11SUB#30 <- #228 PLEASE DO ,12 <- #49 PLEASE DO ,12SUB#1 <- #76 DO ,12SUB#2 <- #190 DO ,12SUB#3 <- #80 DO ,12SUB#4 <- #200 PLEASE DO ,12SUB#5 <- #256 DO ,12SUB#6 <- #248 DO ,12SUB#7 <- #144 DO ,12SUB#8 <- #216 PLEASE DO ,12SUB#9 <- #202 DO ,12SUB#10 <- #14 DO ,12SUB#11 <- #144 DO ,12SUB#12 <- #98 PLEASE DO ,12SUB#13 <- #190 DO ,12SUB#14 <- #160 DO ,12SUB#15 <- #256 DO ,12SUB#16 <- #88 PLEASE DO ,12SUB#17 <- #218 DO ,12SUB#18 <- #36 DO ,12SUB#19 <- #38 DO ,12SUB#20 <- #164 PLEASE DO ,12SUB#21 <- #176 DO ,12SUB#22 <- #48 DO ,12SUB#23 <- #162 DO ,12SUB#24 <- #14 PLEASE DO ,12SUB#25 <- #128 DO ,12SUB#26 <- #208 DO ,12SUB#27 <- #162 DO ,12SUB#28 <- #222 PLEASE DO ,12SUB#29 <- #48 DO ,12SUB#30 <- #8 DO ,12SUB#31 <- #120 DO ,12SUB#32 <- #66 PLEASE DO ,12SUB#33 <- #48 DO ,12SUB#34 <- #246 DO ,12SUB#35 <- #136 DO ,12SUB#36 <- #184 PLEASE DO ,12SUB#37 <- #256 DO ,12SUB#38 <- #202 DO ,12SUB#39 <- #110 DO ,12SUB#40 <- #104 PLEASE DO ,12SUB#41 <- #42 DO ,12SUB#42 <- #126 DO ,12SUB#43 <- #56 DO ,12SUB#44 <- #88 PLEASE DO ,12SUB#45 <- #72 DO ,12SUB#46 <- #56 DO ,12SUB#47 <- #80 DO ,12SUB#48 <- #242 PLEASE DO ,12SUB#49 <- #228 PLEASE DO ,13 <- #31 PLEASE DO ,13SUB#1 <- #76 DO ,13SUB#2 <- #190 DO ,13SUB#3 <- #80 DO ,13SUB#4 <- #200 PLEASE DO ,13SUB#5 <- #256 DO ,13SUB#6 <- #248 DO ,13SUB#7 <- #144 DO ,13SUB#8 <- #216 PLEASE DO ,13SUB#9 <- #202 DO ,13SUB#10 <- #14 DO ,13SUB#11 <- #144 DO ,13SUB#12 <- #98 PLEASE DO ,13SUB#13 <- #190 DO ,13SUB#14 <- #160 DO ,13SUB#15 <- #256 DO ,13SUB#16 <- #88 PLEASE DO ,13SUB#17 <- #74 DO ,13SUB#18 <- #14 DO ,13SUB#19 <- #128 DO ,13SUB#20 <- #114 PLEASE DO ,13SUB#21 <- #214 DO ,13SUB#22 <- #24 DO ,13SUB#23 <- #112 DO ,13SUB#24 <- #162 PLEASE DO ,13SUB#25 <- #22 DO ,13SUB#26 <- #104 DO ,13SUB#27 <- #80 DO ,13SUB#28 <- #256 PLEASE DO ,13SUB#29 <- #194 DO ,13SUB#30 <- #36 DO ,13SUB#31 <- #256 PLEASE DO ,20 <- #10 PLEASE DO ,20 SUB #1 <- #76 DO ,20 SUB #2 <- #196 DO ,20 SUB #3 <- #4 DO ,20 SUB #4 <- #132 PLEASE DO ,20 SUB #5 <- #36 DO ,20 SUB #6 <- #164 DO ,20 SUB #7 <- #228 DO ,20 SUB #8 <- #100 PLEASE DO ,20 SUB #9 <- #52 DO ,20 SUB #10 <- #180 PLEASE DO ,21 <- #10 BY #10 PLEASE DO ,21SUB#1#1 <- #248 PLEASE DO ,21SUB#1#2 <- #120 PLEASE DO ,21SUB#1#3 <- #184 PLEASE DO ,21SUB#1#4 <- #56 PLEASE DO ,21SUB#1#5 <- #216 PLEASE DO ,21SUB#1#6 <- #88 PLEASE DO ,21SUB#1#7 <- #152 PLEASE DO ,21SUB#1#8 <- #24 PLEASE DO ,21SUB#1#9 <- #232 PLEASE DO ,21SUB#1#10 <- #104 DO ,21SUB#2#1 <- #128 DO ,21SUB#2#2 <- #256 DO ,21SUB#2#3 <- #64 DO ,21SUB#2#4 <- #192 DO ,21SUB#2#5 <- #96 DO ,21SUB#2#6 <- #224 DO ,21SUB#2#7 <- #32 DO ,21SUB#2#8 <- #160 DO ,21SUB#2#9 <- #112 DO ,21SUB#2#10 <- #240 DO ,21SUB#3#1 <- #64 DO ,21SUB#3#2 <- #192 DO ,21SUB#3#3 <- #256 DO ,21SUB#3#4 <- #128 DO ,21SUB#3#5 <- #32 DO ,21SUB#3#6 <- #160 DO ,21SUB#3#7 <- #224 DO ,21SUB#3#8 <- #96 DO ,21SUB#3#9 <- #48 DO ,21SUB#3#10 <- #176 DO ,21SUB#4#1 <- #192 DO ,21SUB#4#2 <- #64 DO ,21SUB#4#3 <- #128 DO ,21SUB#4#4 <- #256 DO ,21SUB#4#5 <- #160 DO ,21SUB#4#6 <- #32 DO ,21SUB#4#7 <- #96 DO ,21SUB#4#8 <- #224 DO ,21SUB#4#9 <- #176 DO ,21SUB#4#10 <- #48 PLEASE DO ,21SUB#5#1 <- #32 PLEASE DO ,21SUB#5#2 <- #160 PLEASE DO ,21SUB#5#3 <- #224 PLEASE DO ,21SUB#5#4 <- #96 PLEASE DO ,21SUB#5#5 <- #256 PLEASE DO ,21SUB#5#6 <- #128 PLEASE DO ,21SUB#5#7 <- #192 PLEASE DO ,21SUB#5#8 <- #64 PLEASE DO ,21SUB#5#9 <- #16 PLEASE DO ,21SUB#5#10 <- #144 DO ,21SUB#6#1 <- #160 DO ,21SUB#6#2 <- #32 DO ,21SUB#6#3 <- #96 DO ,21SUB#6#4 <- #224 DO ,21SUB#6#5 <- #128 DO ,21SUB#6#6 <- #256 DO ,21SUB#6#7 <- #64 DO ,21SUB#6#8 <- #192 DO ,21SUB#6#9 <- #144 DO ,21SUB#6#10 <- #16 DO ,21SUB#7#1 <- #96 DO ,21SUB#7#2 <- #224 DO ,21SUB#7#3 <- #32 DO ,21SUB#7#4 <- #160 DO ,21SUB#7#5 <- #64 DO ,21SUB#7#6 <- #192 DO ,21SUB#7#7 <- #256 DO ,21SUB#7#8 <- #128 DO ,21SUB#7#9 <- #80 DO ,21SUB#7#10 <- #208 DO ,21SUB#8#1 <- #224 DO ,21SUB#8#2 <- #96 DO ,21SUB#8#3 <- #160 DO ,21SUB#8#4 <- #32 DO ,21SUB#8#5 <- #192 DO ,21SUB#8#6 <- #64 DO ,21SUB#8#7 <- #128 DO ,21SUB#8#8 <- #256 DO ,21SUB#8#9 <- #208 DO ,21SUB#8#10 <- #80 PLEASE DO ,21SUB#9#1 <- #16 PLEASE DO ,21SUB#9#2 <- #144 PLEASE DO ,21SUB#9#3 <- #208 PLEASE DO ,21SUB#9#4 <- #80 PLEASE DO ,21SUB#9#5 <- #240 PLEASE DO ,21SUB#9#6 <- #112 PLEASE DO ,21SUB#9#7 <- #176 PLEASE DO ,21SUB#9#8 <- #48 PLEASE DO ,21SUB#9#9 <- #256 PLEASE DO ,21SUB#9#10 <- #128 DO ,21SUB#10#1 <- #144 DO ,21SUB#10#2 <- #16 DO ,21SUB#10#3 <- #80 DO ,21SUB#10#4 <- #208 DO ,21SUB#10#5 <- #112 DO ,21SUB#10#6 <- #240 DO ,21SUB#10#7 <- #48 DO ,21SUB#10#8 <- #176 DO ,21SUB#10#9 <- #128 DO ,21SUB#10#10 <- #256 PLEASE DO ,22 <- #10 PLEASE DO ,22 SUB #1 <- #8 DO ,22 SUB #2 <- #136 DO ,22 SUB #3 <- #72 DO ,22 SUB #4 <- #200 PLEASE DO ,22 SUB #5 <- #40 DO ,22 SUB #6 <- #168 DO ,22 SUB #7 <- #104 DO ,22 SUB #8 <- #232 PLEASE DO ,22 SUB #9 <- #24 DO ,22 SUB #10 <- #152 DO .10 <- #9 DO .11 <- #9 PLEASE DO ,10 <- #1 PLEASE DO ,10SUB#1 <- #176 DO READ OUT ,10 DO COME FROM (999) DO (500) NEXT PLEASE DO ,11SUB#1 <- .5 DO READ OUT ,11 DO (500) NEXT DO ,12SUB#1 <- .5 PLEASE DO READ OUT ,12 PLEASE DO .6 <- '?"!10~.10'~#1"$#1'~#3 DO (50) NEXT PLEASE DO .7 <- '?"!11~.11'~#1"$#1'~#3 DO (70) NEXT DO .2 <- #1 DO .1 <- .11 PLEASE DO (1010) NEXT DO .11 <- .3 DO (600) NEXT DO (101) NEXT (70) DO (71) NEXT DO .11 <- #9 DO .2 <- #1 PLEASE DO .1 <- .10 DO (1010) NEXT DO .10 <- .3 DO (600) NEXT DO (101) NEXT (71) DO RESUME .7 (50) DO (51) NEXT PLEASE DO FORGET #1 DO .2 <- #1 DO .1 <- .11 PLEASE DO (1010) NEXT DO .11 <- .3 DO (600) NEXT PLEASE DO .7 <- '?"!11~.11'~#1"$#1'~#3 DO (80) NEXT DO (101) NEXT (80) DO (81) NEXT DO GIVE UP (81) DO RESUME .7 (51) DO RESUME .6 (101) DO FORGET #1 (999) DO FORGET #1 (600) DO (500) NEXT DO ,13SUB#1 <- .5 DO READ OUT ,13 DO RESUME #1 (500) DO ,30 <- #1 DO .1 <- .10 DO (1020) NEXT PLEASE DO ,30SUB#1 <- ,20SUB.1 DO READ OUT ,30 DO .3 <- .1 DO .1 <- .11 DO (1020) NEXT PLEASE DO ,30SUB#1 <- ,21SUB .3 .1 DO READ OUT ,30 DO .5 <- ,22SUB.1 PLEASE DO RESUME #1 | ||||||||||||||||||||||||||
Programming language: Io | ||||||||||||||||||||||||||
See http://www.dekorte.com/Software/C/Io/ bottle = block(i, if(i==0, return "no more bottles of beer") if(i==1, return "1 bottle of beer") return "" .. i .. " bottles of beer" ) for(i, 99, 1, current = bottle(i) write(current, " on the wall, ", current, ",\n", "take one down, pass it around,\n", bottle(i - 1), " on the wall.\n\n") ) | ||||||||||||||||||||||||||
Programming language: io | ||||||||||||||||||||||||||
# io version of 99 bottles of beer # Laurent Vogel, http://lvogel.free.fr # Tested with the Amalthea interpreter: # http://www.dtek.chalmers.se/~d97masa/files/amalthea084.zip declare p: -> s c; print_string_ s c. declare nl: -> c; print_string "" c. declare a: -> n c; = 0 n (p "No more" c); print_int_ n; c. declare b: -> n c; = 1 n c; p "s"; c. declare q: -> n c; a n ; p " bottle"; b n; p " of beer"; c. declare r: -> n c; q n; p " on the wall,"; nl; q n; p "."; nl; p "Take one down, pass it around,"; nl; - n 1 -> n; q n; p " on the wall."; nl; nl; = 0 n c; r n c. r 99 terminate | ||||||||||||||||||||||||||
Programming language: IRCII | ||||||||||||||||||||||||||
This is the scripting language for Inter Relay Chat. alias bottles.start { while (1) { @ bottles.count = 99; while ( bottles.count ) { bottles.sayonwall , bottles.say echo Take one down and pass it around @ bottles.count = bottles.count - 1 bottles.sayonwall . echo } echo No more bottles of beer on the wall, echo no more bottles of beer, echo Go to the store and buy some more, echo 99 bottles of beer on the wall. echo } } alias bottles.sayonwall echo $bottles.count bottles of beer on the wall$0 alias bottles.say echo $bottles.count bottles of beer, bottles.start | ||||||||||||||||||||||||||
Programming language: Irie Pascal | ||||||||||||||||||||||||||
// Irie Pascal version of 99 Bottles of beer (Bottles.pas) // See http://www.irietools.com/ // Philipp Winterberg, http://www.winterbergs.de program Bottles(output); var b: byte; a, c: string; begin a:= #32+#98+#111+#116+#116+#108+#101+#40+#115+#41+#32+#111+#102+#32+#98+#101+#101+#114; c:= #32+#111+#110+#32+#116+#104+#101+#32+#119+#97+#108+#108; b:= 99; repeat writeln(b:2, a, c, #44, #13, #10, b:2, a, #46, #13, #10, #84, #97, #107, #101, #32, #111, #110, #101, #32, #100, #111, #119, #110, #44, #32, #112, #97, #115, #115, #32, #105, #116, #32, #97, #114, #111, #117, #110, #100, #44); dec(b); writeln(b:2, a, c, #46, #13, #10); until b = 0; end. | ||||||||||||||||||||||||||
Programming language: ISETL | ||||||||||||||||||||||||||
$ ISETL version of 99 Bottles of beer (Bottles.stl) $ See http://isetlw.muc.edu/isetlw/about.htm $ Philipp Winterberg, http://www.winterbergs.de program Bottles; local b; b:= 99; while b > 0 do printf b, " bottle(s) of beer on the wall,\n"; printf b, " bottle(s) of beer.\n"; b:= b - 1; printf "Take one down, pass it around,\n"; printf b, " bottle(s) of beer on the wall.\n\n"; end; end; | ||||||||||||||||||||||||||
Programming language: ISM/SML | ||||||||||||||||||||||||||
SML is the language used in ISM/Openmaster, the BULL Administrative Platform. ISM/SML (for Integrated System Management / System Management Language). ; Code Begin ; A.Brunet@frcl.bull.fr (Alain Brunet) (defun beer(cap) (dotimes (i cap) (print (- cap i) " bottle" (if (= i (- cap 1)) "" "s") " of beer on the wall.") (print "Take one down, pass it around.\n") ) (print "Time to buy more beer !") ) (beer 99) | ||||||||||||||||||||||||||
Programming language: IT | ||||||||||||||||||||||||||
This may not qualify for your programming language survey because there are only 2 or 3 pieces of equipment in the world that would run it. The IT (interface tester) was designed in 1986 to test our product's ability to respond to serial control commands. IT's top speed is 38.4 Kbaud (and on a 1 MHz processor, that was considered fast!) IT's a Mot 6809 based thing. Anyway, it has a sort of "shell" that is capable of some rudimentary loops and conditionals. I no longer work at GPS (Graham-Patten Systems http://www.gpsys.com ) but IT lives on and is still used today to test our products. So, IT's programming language is over 15 years old. This has to be all on one line. No \n's. do 99 (echo -100 bottles of beer on the wall;de 1;echo -100 bottles of beer;de 1;echo You take one down pass it around;de 1;-99 bottles of beer on the wall);echo All gone! | ||||||||||||||||||||||||||
Programming language: ITCL Shell | ||||||||||||||||||||||||||
#!/usr/local/bin/itcl_sh # [incr Tcl] version of "99 bottles of beer" # Author: Steven Grady # grady@xcf.berkeley.edu itcl_class bottle { constructor {config} { incr numBottles } destructor { incr numBottles -1 } method drink {} { puts "Take one down, pass it around," $this delete } proc numBottleStr {} { switch $numBottles { 0 { return "No more bottles of beer" } 1 { return "1 bottle of beer" } default { return "$numBottles bottles of beer" } } } proc numBottles {} { return $numBottles } common numBottles 0 } proc createBottles {numBottles} { for {set i 0} {$i < $numBottles} {incr i} { bottle #auto } } createBottles 99 foreach b [itcl_info objects -class bottle] { set str [bottle :: numBottleStr] puts "$str on the wall, $str" $b drink puts "[bottle :: numBottleStr] on the wall." } | ||||||||||||||||||||||||||
© Oliver Schade <os@ls-la.net>, Generated: 06.06.2003 17:38:32 |