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 Reflection Basic Script

(WRQ's Reflection for Unix & Digital)

Date:08/21/06
Author:Jukka Rajakangas
URL:n/a
Comments:2
Info:http://www.wrq.com
Score: (2.91 in 11 votes)
Sub Main
	With Application
	
	Open "c:\temp\lyrics.txt" For Output As #1
	
	Dim i%
	Dim row1$, row2$, row3$
	
	i = 99

	row3 = "Take one down and pass it around, no more bottles of beer on the wall." & _
                   Chr(10) & Chr(10) & _
		   "No more bottles of beer on the wall, no more bottles of beer." & Chr(10) & _
		   "Go to the store and buy some more, 99 bottles of beer on the wall."
	
	while i > 0 
		row1 = i & " bottles of beer on the wall, " & i & " bottles of beer."
		row2 = "Take one down and pass it around, " & i-1 & " bottles of beer on the wall." & Chr(10)
		
		Print #1, row1
		
		If i > 1 Then
			Print #1, row2
		Else
			Print #1, row3
		End If	
		i = i - 1
	wend

	End With
End Sub

Download Source | Write Comment

Alternative Versions

Comments

>>  Jukka Rajakangas said on 08/23/06 08:10:39

Jukka Rajakangas The 1 bottle verse should be changed, so the loop should be like this:

while i > 0
row1 = i & " bottles of beer on the wall, " & i & " bottles of beer."
row2 = "Take one down and pass it around, " & i-1 & " bottles of beer on the wall." & Chr(10)

If i > 1 Then
Print #1, row1
Else
Print #1, "1 bottle of beer on the wall, 1 bottle of beer."
End If

If i > 1 Then
Print #1, row2
Else
Print #1, row3
End If
i = i - 1
wend

>>  barrym said on 07/19/10 03:37:36

barrym Nice revision, Jukka. Isn't it frustrating to see the incorrect version at the top
of the page every time you visit it? I've done the same thing a few times, and no
matter how hard I try, I can't seem to prevent it from happening. My wish is that
the confirmation e-mail sent when the language is accepted would include a password
allowing the author to make his or her own revisions to the posting. :-?

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: