real language

Bookmarking Digg Diigo DZone Earthlink Google
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Run BASIC

Author:Brent Thorn
Score: (2.94 in 17 votes)
'** 99 Bottles of Beer in Run BASIC
'** A Web development tool for Windows, Mac OS X, and Linux.
'** This example dynamically generates a Web page of lyrics.

' Define some constants.
q$ = Chr$(34)
BeerOnTheWall$ = " of beer on the wall"
Beer$ = " of beer!"

' Close the "monospaced" div.
Html "</div>";

' Let the lyrics scroll.
Html "<div style=";q$;"border:1px solid; height:25em; padding:.5em; overflow:auto;";q$;">";

' Generate the lyrics...
For bottle = 99 To 1 Step -1

  ' start paragraph
  Html "<p>";

    ' line 1
    Print Bottles$(bottle) ; BeerOnTheWall$ ; ". " ;
    Print Bottles$(bottle) ; Beer$

    ' line 2
    Print "Take one down and pass it around. " ;
    Print Bottles$(bottle-1) ; BeerOnTheWall$ ; "!" ;

  ' end paragraph
  Html "</p>";

Next bottle

' Last lines...
Html "<p>";
  Print Bottles$(0) ; BeerOnTheWall$ ; ". " ;
  Print Bottles$(0) ; Beer$
  Print "Go to the store and buy some more. " ;
  Print Bottles$(99) ; BeerOnTheWall$ ; "!" ;
Html "</p></div>";


' "Bottles$()" takes a number of bottles and 
' returns an appropriate description of them.
Function Bottles$( Bottles )
  Select Case Bottles
    Case    0: Bottles$ = "No more bottles"
    Case    1: Bottles$ = "1 bottle"
    Case Else: Bottles$ = Bottles ; " bottles"
  End Select
End Function

Download Source | Write Comment

Alternative Versions


>>  AMALIAFrazier23 said on 05/22/10 13:58:02

AMALIAFrazier23 Houses are expensive and not everyone is able to buy it. Nevertheless, <a href="">mortgage loans</a> are invented to aid people in such cases.

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!




Security Code: