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 Run BASIC

Date:02/05/07
Author:Brent Thorn
URL:http://www.b6sw.com/
Comments:1
Info:http://www.runbasic.com/
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>";

End

' "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

Comments

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

AMALIAFrazier23 Houses are expensive and not everyone is able to buy it. Nevertheless, <a href="http://lowest-rate-loans.com/topics/mortgage-loans">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!

Name:

eMail:

URL:

Security Code:
  
Comment: