real language

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

Language RBasic+

(First example of RBasic+ from Revelation)

Author:DSig (David Tod Sigafoos)
Score: (2.91 in 11 votes)
function NintyNine_BottlesOfBeer( void )
abstract:	simple rbasic program for the 99bottlesofbeer site
			nothing fancy .. can be run from editor or put
			in a text box .. or simple oswrite to disk
			Note .. this source is cross compatible with Advanced Revealtion
			and except for SWAP and function .. compatible with Revelation
author:		dsig (David Tod Sigafoos)
date:		17jul05

*--	just equate some items .. 
equ TRUE$ to 1
equ FALSE$ to 0
equ NULL$ to ''
equ CRLF$ to char(13):char(10)

*-	build our default strings .. 
strSong = NULL$
line1 = '%%count1%% bottles of beer on the wall, %%count1%% bottles of beer ...'
line2 = 'take one down and pass it around, %%count2%% bottles of beer on the wall'
endSongLine1 = 'No more bottle of beer on the wall. No more bottles of beer...'
endSongLine2 = 'Go to the store and buy some more...99 bottles of beer.'

*--	simple for/next going backwards.  Use simple replacement text to 
*	stuff correct numbers and text
for bottlesOfBeer = 99 to 0 step -1
	begin case
	case bottlesOfBeer GT 1
		strSong := CRLF$ : line1 : CRLF$ : line2
		swap '%%count1%%' with bottlesOfBeer in strSong
		*	when we hit 2 bottles .. take one down should leave 1 BOTTLE
		if bottlesOfBeer = 2 then
			swap '%%count2%% bottles' with bottlesOfBeer-1:' bottle' in strSong
		end else
			swap '%%count2%%' with bottlesOfBeer-1 in strSong
	case bottlesOfBeer = 1
		strSong := CRLF$:line1 : CRLF$ : line2
		swap '%%count1%% bottles' with bottlesOfBeer:' bottle' in strSong
		swap '%%count2%%' with 'no more' in strSong
	case bottlesOfBeer = 0
		strSong := CRLF$:endSongLine1 : CRLF$ : endSongLine2
	end case
	*-- need that space between verses
	strSong := CRLF$
next bottlesOfBeer	
return strSong

Download Source | Write Comment

Alternative Versions


>>  Simon Wilmot said on 07/21/05 09:48:46

Simon Wilmot Perhaps to add some realism .... ;o)


SlurLevel = 0
VerticalAbility = 99

In the loop,

SlurLevel += 1
VerticalAbility -= 1

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: