99 Bottles of Beer
One program in 571 languages
 
     
  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
4D   4DOS Batch   4Test  
 
  Programming language: 4D
 
  `<A HREF="http://www.4d.com">4th Dimension</A> is a
  ` RDBMS development environment
  `available for Macintosh and Windows.

  ` 4D version of 99 bottles of bottels of beer on the wall
  ` 2003 (john.windberg@dwdev.com)

ON ERR CALL("")
C_STRING(1;$s)
C_INTEGER($beers;$tickCount;$delay)
$delay:=100
$s:="s";

For ($beers;4;0;-1)
MESSAGE(String($beers)+" bottle"+$s+" of beer on the
wall, ")
$tickCount:=Tickcount
While (Tickcount<($tickCount+$delay))
DELAY PROCESS(Current process;1)
End while 

MESSAGE(String($beers)+" bottle"+$s+" of beer, ")
$tickCount:=Tickcount
While (Tickcount<($tickCount+$delay))
DELAY PROCESS(Current process;1)
End while 

If ($beers=0)

MESSAGE("Go to the store, buy some more, ")
$tickCount:=Tickcount
While (Tickcount<($tickCount+$delay))
DELAY PROCESS(Current process;1)
End while 

MESSAGE("99 bottles of beer on the wall.")
$tickCount:=Tickcount
While (Tickcount<($tickCount+$delay))
DELAY PROCESS(Current process;1)
End while 

Else 
MESSAGE("Take one down, pass it around, ")
$tickCount:=Tickcount
While (Tickcount<($tickCount+$delay))
DELAY PROCESS(Current process;1)
End while 

If ($beers=2)
$s:=""
Else 
$s:="s"
End if 

MESSAGE(String($beers-1)+" bottle"+$s+" of beer on the
wall.")
$tickCount:=Tickcount
While (Tickcount<($tickCount+$delay))
DELAY PROCESS(Current process;1)
End while 

End if 

End for
 
  Programming language: 4DOS Batch
 
@ECHO OFF

:: BEER.BTM - 4DOS version 5.5 batch (btm) file
:: by Rodney M. Savard <rodney.savard%phun@phunnet.org>

SETLOCAL

SET plural=`s`

DO bottle = 99 TO 1 BY -1
   ECHOS %bottle% bottle%plural% of beer on the wall,
   ECHO  %bottle% bottle%plural% of beer.

   ECHOS Take one down, pass it around,

   IFF (%@EVAL[%bottle% - 1]) == (0) THEN
      ECHO  no more bottles of beer on the wall.
   ELSE
      IF (%@EVAL[%bottle% - 1]) == (1) UNSET plural
      ECHO  %@EVAL[%bottle% - 1] bottle%plural% of beer on the wall.
      ECHO.
   ENDIFF
ENDDO

ENDLOCAL
 
  Programming language: 4Test
 
4Test is the language used for GUI testing by Segue Software's QA Partner.

// 4Test Version of 99 Bottles of beer
//
// Eric DeCosta 
//
testcase bottles()
	INTEGER bottles
	for (bottles = 99; bottles >0;)
		print("{bottles}  bottle(s) of beer on the wall,")
		print("{bottles}  bottle(s) of beer.")
		print("Take one down, pass it around,")
		print("{--bottles} bottle(s) of beer on the wall.")
 
  © Oliver Schade <os@ls-la.net>, Generated: 06.06.2003 17:38:31