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 YCP

Date:05/21/06
Author:Arvin Schnell
URL:http://arvin.schnell-web.net
Comments:0
Info:n/a
Score: (3.35 in 26 votes)
/*
 *  Author: Arvin Schnell
 *
 *  Tested on SuSE Linux 10.1, run:
 *  /usr/lib/YaST2/bin/y2base beer.ycp qt
 */

{
    textdomain "beer";

    define string line1 (integer beers)
    {
	switch (beers)
	{
	    case 0:
		return _("No more bottles of beer on the wall, no more bottles of beer.");

	    default:
		return sformat (_("%1 bottle of beer on the wall, %1 bottle of beer.",
				  "%1 bottles of beer on the wall, %1 bottles of beer.",
				  beers), beers);
	}
    }

    define string line2 (integer beers)
    {
	switch (beers)
	{
	    case 0:
		return _("Go to the store and buy some more, 99 bottles of beer on the wall.");

	    case 1:
		return _("Take one down and pass it around, no more bottles of beer on the wall.");

	    default:
		return sformat (_("Take one down and pass it around, %1 bottle of beer on the wall.",
				  "Take one down and pass it around, %1 bottles of beer on the wall.",
				  beers - 1), beers - 1);
	}
    }

    string lyrics = "";
    integer beers = 99;
    while (beers >= 0)
    {
	lyrics = lyrics + "<p>" + line1 (beers) + "<br>" + line2 (beers) + "</p>";
	beers = beers - 1;
    }

    term dialog = `HBox (
			 `VSpacing (30),
			 `VBox (
				`HSpacing (60),
				`RichText (lyrics),
				`PushButton (`id (`ok), "I Agree")
				)
			 );

    UI::OpenDialog (dialog);
    UI::SetFocus (`id (`ok));
    UI::UserInput ();
    UI::CloseDialog ();
}

Download Source | Write Comment

Alternative Versions

Comments

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: