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 1C Enterprize

Date:07/22/05
Author:Alexey Baranov
URL:n/a
Comments:4
Info:http://www.1c.ru/
Score: (2.92 in 50 votes)
// calling by pressing button on form 
// Alexey Baranov wdayda@yahoo.com
Procedure bottles()
	s = "s";     
	beer = 99;
	While beer<>0 do
		Message(String(beer) + " bottle " + s + " of beer on the wall, " + String(beer) + " bottle" + s +
" of beer."); 
		Message("Take one and pass it around.");
		beer = beer - 1;
		s = ?(beer = 1,"","s");
	EndDo;
	Message("No more bottles of beer on the wall.");
	Message("No more bottles of beer...");
	Message("Go to the story and buy some more...");
	Message("99 bottles of beer.");
EndProcedure

Download Source | Write Comment

Alternative Versions

Comments

>>  alex said on 07/26/05 08:35:16

alex %))

>>  hell0g said on 04/13/09 15:31:17

hell0g faken rashen bydlosheet.
bottles - is typed 98 times, bottle - only 1, and all 99 times the cheking is making.

>>  barrym said on 07/10/10 07:13:17

barrym hellOg, I think that Alexey did it that way because he was thinking of source size
considerations rather than execution speed (he could have taken it a bit further by
putting a 'no more' check and substitution inside the loop as well).
Performing a repetitive check is one of the few things that computers do
brilliantly!!

>>  barrym said on 07/14/10 08:02:28

barrym Ugh! After going through the trouble of defending Alexey's coding, I realized that
his output is missing the fourth fragment of all the verses except the last!

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: