So Many Languages, So Little Time

In the past I’ve programmed in Basic, Pascal, Assembly Language, Fortran, Cobol, C, Java, Flash (does that count?), Shell Scripts, Quel, ABF, HTML, SQL, Perl, PSQL, PL/SQL and probably a few more if I really think about it and it seems that I’m not particularly unusual. A few of us at work decided to see how many ways we could program the FizzBuzz game. I submitted a couple of entries – one in PL/SQL and another in LOLCode:

SET SERVEROUTPUT ON FORMAT WRAPPED
DECLARE
i PLS_INTEGER:=0;
str VARCHAR2(8);
BEGIN
WHILE (i <= 100) LOOP
DBMS_OUTPUT.new_line;
str := CHR(10);
i := i+1;
IF (MOD(i,3) = 0) THEN
str:=’Fizz’;
END IF;
IF (MOD(i,5) = 0) THEN
str:= str || ‘Buzz’;
END IF;
DBMS_OUTPUT.put_line(str);
END LOOP;
END;
/

HAI
BTW Go Here for more on LOLCode – http://progopedia.com/language/lolcode/
CAN HAS STDIO?
O NOES
INVISIBLE “Error!”

I HAS A LIMIT ITZ 100
I HAS A LOOPYCOUNT ITZ 0
I HAS A NUFFIN ITZ 0
I HAS A STRING
BTW LOLCats love string

IM IN YR LOOP UPPIN YR LOOPYCOUNT TIL BOTH SAEM LOOPYCOUNT AN LIMIT
I HAS A NUM ITZ MOD OF LOOPYCOUNT AN 3
SAEM NUM AN NUFFIN, O RLY?
YA RLY,
I HAS A NUVVERNUM ITZ MOD OF LOOPYCOUNT AN 5
SAEM NUVVERNUM AN NUFFIN, O RLY?
YA RLY, STRING R ‘FizzBuzz’
NO WAI, STRING R ‘Fizz’
OIC
NO WAI,
I HAS A NUVVERNUVVERNUM ITZ MOD OF LOOPYCOUNT AN 5
SAEM NUVVERNUVVERNUM AN NUFFIN, O RLY?
YA RLY, STRING R ‘Buzz’
NO WAI, STRING R ‘ ‘
OIC
OIC
VISIBLE STRING
IM OUTTA YR LOOP
KTHXBYE

(actually, and somewhat surprisingly, I think my LOLCode is better than my PL/SQL as I should really have used a FOR LOOP instead of a WHILE loop).

Anyhow, other people submitted their examples in their favourite language and we had quite a list before someone pointed out that this had already done and to a ridiculous extent. Take a wander here and be truly amazed. My favourite is probably whitespace but there are some others that will probably make you smile too.

Advertisements

About dnadba

I work with databases and stuff
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s