Voting

Category

esoteric language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language pBasic

(Uses a FOR...NEXT loop)

Date:07/29/09
Author:Wyatt Sheffield
URL:n/a
Comments:1
Info:http://www.parallax.com
Score: (3.00 in 12 votes)
' {$STAMP BS2}
' {$PBASIC 2.5}
' +----------------------------------------+
' | "99 Bottles of Beer" lyrics generator  |
' | written in PBasic language 2.5 for the |
' | Basic Stamp 2 microcontroller.         |
' | Written by Wyatt Sheffield             |
' +----------------------------------------+

'-----------[Variables]---------------------
counter     VAR Byte                        'general purpose counter
wall        VAR Byte                        'Counts down number of bottles
around      VAR Byte                        'Counts down number of bottles
                                            ' (The names of the variables are
                                            ' as such because wen asked TO print a
                                            ' value, the microcontroller gives
                                            ' the variable name, THEN the value.)
'--------------[Body]-----------------------
Reset:

wall = 99
around = 99

DEBUG "99 bottles of beer on the wall,",
      "99 bottles of beer!", CR,
      "Take one down, pass it "

Main:

FOR counter = 1 TO 97 STEP 1                'loops 97 times before exiting.
     wall = wall - 1                        'subtracts 1 from the previous value each loop.
     around = around - 1
     DEBUG ? around, " bottles of beer on the "
     DEBUG ? wall, "bottles of beer!  Take one down, pass it "
NEXT

DEBUG "around, 1 bottle of beer on the wall.", CR,
      "1 bottle of beer ON the wall, ",
      "1 bottle of beer!  Take it down, pass it around,",
      "No more bottles of beer on the wall!"

END

Download Source | Write Comment

Alternative Versions

Comments

>>  barrym said on 07/16/10 06:56:29

barrym A "FOR ... NEXT" loop? In BASIC? What an outrageous way to set your code apart
from the crowd! (JK) ;-) I think the debug print is semi-neat.

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: