Fun with Pseudocode

A long time ago, I saw this on bash.org:

A programmer started to cuss
Because getting to sleep was a fuss
As he lay there in bed
Looping ’round in his head
was: while(!asleep()) sheep++

It inspired me to name my blog foreach(bill) paywith(skill), which was intended to “pseudocodify,” if you will, the expression, “Skills to pay the bills.”

Recently I asked the audience of StackOverflow.com if they knew of any others. Here’s a few of my favorites, some of them with my slight modifications.

Shakespeare:

question = 2*b || !(2*b)

Working for the man:

class Employee
{
	long hours;
	short lunch;
	byte pay;
}

A Star Wars reference to Yoda, who says, “Try not. Do… or do not. There is no try.”:

do() || !do()
// try()

A classic:

while(!(succeed = try());

From Futurama, in BASIC:

10 SIN
20 GOTO HELL

Ah, to be a kid again.

if (happy && know(it)) hands.clap();
Advertisements

1 Comment »

  1. Sunny said

    Great to have you back!

RSS feed for comments on this post · TrackBack URI

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

%d bloggers like this: