share
Stack OverflowWhat is your best pseudo-code phrase?
[+91] [69] Chris
[2009-03-19 03:33:18]
[ fun pseudocode ]
[ http://stackoverflow.com/questions/660972] [DELETED]

Do you have any clever pseudo-code phrases? Maybe a common phrase that has analogous pseudo-code? What's your best one?

For example, one I've seen, from bash.org [1]:

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++

One I thought of/use:

Have any to share?

What would you call these if you gave them a name?

+1 because I want it to last. If funniest comments can stay open, then this should too. - Perchik
Probably should be community wiki. - John Feminella
Ugh, I fear this will be closed. Damn SO Gestapo. Upvote away! :D - Chris
John: How do I do that? - Chris
@Chris: Edit the post, then check the little box in the lower-right marked "community wiki". - John Feminella
(2) Shouldn't it be: while(!sleep) sheep++ ? - Martin Cote
Oops, right you are! - Chris
Years ago some consulting company from DC held a "UML pictionary" recruiting event. That was a lot of fun. - Uri
This is the last line of a limerick. It is written on a whiteboard at work -- I'll get it and add it tomrorrow. - thursdaysgeek
It's questions like this that make me wish they implemented this - stackoverflow.uservoice.com/pages/general/suggestions/121734 - Evan
Original source: bash.org/?845468 - Adam Rosenfield
@Adam: haha that is quite funny! - alex
@Adam: Good catch! I just Googled it myself and knew it was from bash. Ah, the wealth of geek thought that is bash.org! - Chris
I don't want to close it but I do hate the title. - hasen j
I'm fairly sure the limerick was here: limerickdb.com/?282 before it was on bash.org. - Blorgbeard
Was just about to moan and whine about the closing of a valid question blah blah, and then I noticed 4 reopens already, and bing! Enjoy! - Ali Afshar
@Blorgbeard: it's impossible to tell which came first, but limerickdb has only been around for barely over a year, whereas bash.org is much, much older - Adam Rosenfield
Vote to reopen, on the grounds that it demonstrates expressive programming languages. - Adam Liss
I voted to re-open. - Sara Chipps
LOL @ the offensive vote - Chris
Heck, !Y... :) - Øystein
[+119] [2009-03-19 03:37:01] cobbal [ACCEPTED]

Always deserves a mention:

2 * b || ! (2 * b)

Awesome, love it! - Chris
(11) If that's the question, the answer is always TRUE! - Adam Liss
It's a syntax error in C#. ;P - strager
valid in C99, assuming b is defined - cobbal
(25) 0x2b || !0x2b :) - community_owned
(4) char question = 0xFF; if (question == 0x2B | ~0x2B) suffer(outrageous_fortune[slings & arrows]); else take_against(arms, troubles.c) - cobbal
question = (2 * b || ! (2 * b )) - hasen j
(4) @Adam Liss — Not so! What if b is "#define b (++a)" and a is equal to -1 when that line is executed? ;-) - Ben Blank
I was going to upvote this, but want it to stay at 42. Sorry. :) - BenMaddox
Same here. It stays at 42. :) - Agnel Kurian
(3) but "to be or not to be" is the question, not the answer :) - cobbal
2 * b || ! (2 * b) = the meaning of life, the universe & everything :P - alex
(1) -1, has to stay at 42! - Treb
perl -e 'print 0x2b|!0x2b, "\n"' => 43. Off by one, sorry. - d0k
d0k, 0x2b = 43, but 0x2b | ~0x2b = -1 - hasen j
so (0x2b | ~0x2b) + (0x2b | !0x2b) = 42 - cobbal
0x2B | ~0x2B == 0xFF <- that is the answer. - Zifre
ThinkGeek sells a t-shirt: /bb|[^b]{2}/ - Samir Talwar
1
[+103] [2009-03-19 04:14:20] Adam Rosenfield

I forget the original source of this; it had some other ones it it, but I also forget what they were.

class Employee
{
    long lunches;
    short hours;
    double pay;
};

(21) How about: short lunches; long hours; bit pay; - Chris
What about byte juniors; - Jonathan Parker
(16) I think that should be "class Manager" - A. Levy
(16) @Chris, i think you are missing byte me;. - Georg Fritzsche
From where I live "class" also means fantastic - TWith2Sugars
(1) From where you live "Employee" also means someone who bothers to go to the Job Center. - kjfletch
2
[+91] [2009-03-19 04:02:59] Adam Liss

Code to display the name of everyone's favorite web site ... eventually:

void x(void) { x(); }

(2) hehehe nice one .. took me a coupla seconds to get it - hasen j
(11) what? but stack overflow is my favorite websi.... oh - Joe Philllips
(2) I see what you did there. - sirlancelot
(13) Yay for SegmentationFault.org... wait... wrong language... - cobbal
(3) xxx? That's as far as my brain went. :D - Chris
Can't get what this is. - Vijay Dev
(4) @Vijay Dev: Run it in your head. :) - unwind
same delay here :) - dr. evil
(2) @All: wish I could upvote your comments! - Adam Liss
(14) Tailcall optimization would reduce this to One Infinite Loop... - Tim Lesher
(2) @Vijay Dev: what's happening here? A method is calling itself repeatedly with no exist condition... What will happen if a method calls itself repeatedly with no end in sight? The stack will overflow at some point... StackOverflow.com!! - Shivasubramanian A
(2) @Shiva: Only true if you're using a stack-based language implementation. Nothing about C++ (for example) says that you have to be using a stack. :) - John Feminella
(1) I'm afraid some tail recursion optimization will thwart your plans! :) - Gracenotes
(4) Well what do you know - several months later and I CAN upvote your comments! - Adam Liss
(1) @Tim Lesher, Nobody jokes in tailcode optimization. - Gleno
(2) I tried with gcc and after 261900 times it gives "Segmentation fault" - stivlo
(1) @stivlo: +1 for actually trying it. I'd add another +1 if you'll overlook my gratuitous use of programmer's poetic license! - Adam Liss
eheh it's how developer's mind work, they are inquisitive. I think it actually means that there is no boundary check, so what actually happens is a memory boundary violation. But hey, I mean the joke was funny anyway, maybe rewrite it in Java. :P - stivlo
(1) Ok here you go, Java version. This one actually prints the exception that we'd all love to see :-). After just 1025 times with JDK 1.6 default settings on Linux. class X { public static void main(String[] args) { main(null); } } - stivlo
3
[+69] [2009-03-19 23:01:33] VirtuosiMedia

Apple naming function:

function name($product){
     return 'i'.$product;
}

Google naming function:

function name($product){
     return $product.' beta';
}

Microsoft naming function:

function name($product){
     return name($product);
}

(1) Excellent! +1 for turning "obvious" into "CLEVER" - Adam Liss
(37) MS naming should be: return "Microsoft " + anyof("Windows", "Windows Live", "Live", "Kumo") + $product + " " + year() + " " + anyof("", "Pro", "Personal", "Business", "Enterprise") + anyof("", "RC1", "RC2", "beta") + anyof("", &q - devio
(12) + anyof("", "SP1", "SP2", "SP3") - devio
I'd like to see the MS versioning system also explained. :) - Rev316
(1) @Rev316: function name($product){ return name($product.date("y")); } - VirtuosiMedia
(27) So nobody noticed that the last function is an infinitely recursive function. - Ólafur Waage
(2) @Ólafur i did i did i did !!!!1 - herzmeister
4
[+64] [2009-03-19 04:49:12] Factor Mystic

Classic Foxtrot comic


Gah, beat me to it! I was just about to post this, but it took me a while to find it. - Adam Rosenfield
/me thinks he'd need a try{}catch(){} on that ;) - Kent Fredric
(48) He failed because he forgot the \n terminator. - Ferruccio
(7) @Ferruccio: good spot. I also think it would be better if the for loop went from 0 to <500. Would save one keypress anyway. - demoncodemonkey
(20) I actually did this in 5th grade... I asked permission to type and print my punishment phrase instead of submitting a notebook with 1000 copies. - Uri
(5) @Uri, +1 for beating the system! - Eric
Free Image Hosting in Excess :( - KennyTM
(2) This is totally not optimal. Also, why are blackboards in C? - Gleno
Yeah, he shoulda used puts() - bobobobo
5
[+63] [2009-03-20 03:28:27] Adam Liss
SELECT * FROM businesses WHERE business LIKE 'show_business%';

0 ROWS RETURNED

(4) That's a great one! - Ólafur Waage
6
[+62] [2009-03-19 10:46:41] Ólafur Waage
while(whatWeNeed != education())
{
   wall->add(bricks++);
}

(12) if (meat.hasBeenEaten()) {servePudding();} - James Van Huis
bool wrong = true; do {it_again();} while (wrong); - EvilTeach
(2) pink floyd reference? awesome! - alex
(3) Why do you add an increasing number of bricks each time? Should just be wall->add(brick); - DisgruntledGoat
7
[+51] [2009-03-21 22:21:39] blowdart
bikini.ToString();

ahem.


(11) I prefer Bikini.hide() - Dominic Bou-Samra
This is the best answer here... - Jorn
(1) LMAO :D Amazing! - Christian
(7) Oh, come on now! Bikini.Remove(); - Loren Pechtel
(1) and I bikini.open(); - Viswanathan Iyer
8
[+47] [2009-03-19 03:37:46] John Feminella
void CreateLimerick() {
#define poemKind terriblySlick
  if (lines == 5
  && rhymesWith("live") {
DoLaugh(); Perform(new Trick()); }}

xkcd.com/554 - cobbal
There's coffee on my keyboard now and I blame this answer. +1. - Cyclone
9
[+44] [2009-03-19 04:18:07] Nikhil Chelliah

Spinoff on Uri's answer...

public class Chicken {
    private Chicken() {
        ...
    }
    public Egg layEgg() {
        return new Egg();
    }
}

public class Egg {
    private Egg() {
        ...
    }
    public Chicken hatch() {
        return new Chicken();
    }
}

lol... love this one :D - chakrit
(3) Good...but you need to declare the Chicken as friend to the Egg, and vice-versa. - A. Levy
(1) Shouldn't Egg inherit from Chicken? /me ducks - oɔɯǝɹ
(7) A. Levy, what horrible language are you thinking of? =) - Gleno
10
[+38] [2009-03-20 07:40:12] community_owned
public double penetration;

(4) would that be part of the Employee class? =D - devio
(17) Nope, only the Secretary class has that..... - community_owned
(4) Hopefully a "general protection fault" doesn't occur too. =) - gnovice
My goodness, this must be used in pornoverflow.com's classes. - Starx
11
[+36] [2009-03-19 03:44:18] alex

Can't remember the original off the top of my head (feel free to edit this if you can) but something like this. For Star Wars fans

do || !do;
// try {};

I'm no Star Wars buff. My guess is it's a Yoda quote ending with "to try is nothing." - Chris
(2) "No. Try not. Do... or do not. There is no try. " - Chris Lutz
(1) Thanks! I am humbled by Yoda's wisdom. :) - Chris
Hope my attempt is good enough people can figure it out. Trailing semi colons are just ingrained in me from PHP and JavaScript (optional I know, but I prefer them) - alex
(7) do || !do; //try { } - Joe Philllips
hehehe gooooood good - thomasrutter
I always thought it was: do || !do; #define try - DK.
@DK, I think they all work to some degree... - alex
12
[+27] [2009-03-19 04:18:41] alex

This one was in Futurama

10 HOME
20 SWEET
30 GOTO 10

First one that jumped to mind. =) - gnovice
(2) hehe i always loved that that was an infinite loop :) - thomasrutter
+1 - I'm a sucker for Futurama. - Chris Lutz
HOME SWEET HOME SWEET HOME SWEET... - rlbond
Replace HOME with DUDE for a contemporary movie reference. :) - Macke
@Macke Terribly stupid film. Somewhat entertaining :) - alex
13
[+26] [2009-03-19 04:02:33] Uri
public class Egg
{
    int hashCode()
    {
       ...
    }
}

(3) A way to make sure you don't put all your eggs in one basket... - Uri
Is it meant to sound like hatchCode()? - alex
(4) No, just that if you implement a hashcode on your eggs, they're less likely to all end up in the same basket (or bucket...) - Uri
14
[+24] [2009-03-19 03:49:28] JaredPar

From a t-shirt

i > u

(5) I have that shirt. While I can't argue with the math, the grammar drives me crazy. :-) - Tim Sullivan
@Tim, same to both :) - JaredPar
thats 1 number away from something - community_owned
(1) It looks like "i <3 u" - furtelwart
15
[+24] [2009-03-19 23:12:55] gnovice

Here's a bible one:

class the_earth
{
...
};
class the_meek : public the_earth
{
...
};

(1) Or maybe just this :): class earth {} class meek : earth {} - Chris
That would be a bit shorter. =) - gnovice
"And thusly, said Godeth, >> THE MEEK SHALT INHERIT FROM EARTH <<." No he dadn't. :( - Gleno
16
[+22] [2009-03-19 03:46:21] Adam Liss

Oldie:

while ( !(succeed = try()) );

I love this one. - Josh
Wouldn't this one be: while (!succeed) { try(); } ? - Shaharyar
@Shaharyar: how does "succeed" get updated? - Adam Liss
I assumed that try() is a method inside the class and it would update the value as soon as the function succeeds? - Shaharyar
There's an argument that this should be a do/while... - yahelc
17
[+20] [2009-03-19 03:40:10] gbarry

FORTH LOVE? IF HONK THEN


Okay, I feel stupid. Someone explain this one. - Chris
FORTH is a stack-based language (like an RPN/postfix calculator). You push data on the stack and then compute by pushing an operator than pops its arguments. This expresses the logic "Honk if you love FORTH" in FORTH syntax (assuming that "LOVE?" is a unary operator) - Tyler McHenry
sounds like reverse polish notation or something - Joe Philllips
(2) @d03boy: That's because RPN was created for use in stack based systems ;-) - Treb
18
[+20] [2009-03-19 03:56:23] Adam Liss
10 LATHER
20 RINSE
30 GOTO 10

I know ... downvotes for the GOTO! - Adam Liss
@Chris: Assembly? - X-Istence
@X-lstence: what else has line numbers in 10s and uses GOTOs? - Chris
(3) Assembly would be ":start LTR; RNS; JMP :start" :) - Blorgbeard
19
[+18] [2009-03-19 10:51:02] I.devries
if(youreHappyAndYouKnowIt) {
    clapYourHands();
}

(5) I like the syntax error one more: ratemyeverything.net/image/9914/0/Syntax_Error.ashx - Ólafur Waage
(10) What about if "(youreHappy && youKnowIt)"? Or "if (you.happy && you.knowIt)"? - Matthew Crumley
(6) I thought it was "if ( youreHappyAndYouKnowIt && youReallyWantToShowIt ) ..." - DisgruntledGoat
@Olafur: happy was unexpected at this time. - Mark
20
[+18] [2009-03-21 23:03:02] Alekc
while (looks($girl) < "hot"){
    beer.next();
}

(8) I'd have gone with "beer++"; - gnovice
Ooh, good call gnovice. - Chris
21
[+12] [2009-03-21 22:14:20] Andres
cd pub
more beer

22
[+12] [2009-03-19 10:40:38] Ali Afshar

A bit more cryptic:

mkfifo('dream')

(3) Just a pipe dream? - Chris Connett
23
[+12] [2009-03-19 13:40:03] Steve
def Life()
   while heartbeats
       wakeup
       breakfast
       if weekday
          work
          lunch
          work
       else
          play
          lunch
          play
       supper
       bath
       while (!sex) 
          sleep
   exit

too much duplicate code, you should do something about it. - Tempus
(2) But thats life ... to much repetition ;-) - Steve
no shower or "throne" time? just picking... i like it :) - Ascalonian
I thort about the throne time but that was just a bit toooo much detail! - Steve
Between bath and sleep, I'd want to add sex. - Jonas Kölker
Don't we all Jonas, don't we all! - Gordon Mackie JoanMiro
what about if (!sleep) sex - Steve
Ah, likely endless loop geeks near the end. :) - BenMaddox
Yeah, I noticed that but left it in as who in their right mind would want to get out of that loop! - Steve
24
[+11] [2009-03-19 03:51:13] Uri
pthread_mutex_lock(&coop_mutex);
pthread_cond_wait(&hatched_cv, &coop_mutex); 
ct = count_chickens();
pthread_mutex_unlock(&coop_mutex);

(1) +1 for cleverness -- is that original? - Adam Liss
Yea, I was reading the frigging pthread manual earlier today, so it was in my head when I saw this. Java threads are so much more convenient :) - Uri
25
[+10] [2009-03-19 03:57:37] John Rasch

FK UNICODE

Oh, pseudocode phrases? No...


(4) I prefer the more positive: "I � UNICODE": codinghorror.com/blog/archives/001084.html - Joachim Sauer
26
[+9] [2009-03-19 05:31:57] Jon P

OK So it's SQL but still it tickles my fancy...

Select * from Users
Where Clue is not null

Rows Returned: 0

Courtesy of the Think Geek Overlords


27
[+9] [2009-03-19 22:59:34] Perchik
for(int i=99; i>=0; i--)
{
    if(i!=99) cout<< i <<" bottles of beer on the wall"<<endl;

    cout<<i<<" bottles of beer on the wall, "<< i <<" bottles of beer."
        <<"Take one down, pass it around, "

     if(i==0) cout<<"no more bottles of beer on the wall. Hiccup!"<<endl<<endl;
}

28
[+9] [2009-03-19 23:53:56] kdmurray

The only constant in our world is change:

    public class OurWorld {
      public const int change;
    }

29
[+8] [2009-07-05 01:14:45] DisgruntledGoat

Short but sweet:

grep needle haystack

PHP docs use this terminology in a lot of their search in functions php.net/manual/en/function.in-array.php - alex
30
[+8] [2009-03-19 23:04:49] gnovice

Another from Futurama:

10 SIN
20 GOTO HELL

Why the line numbers ? You're not using them. - ldigas
It was some BASIC code on a banner in the Church of Robotology. - gnovice
31
[+8] [2009-03-19 04:30:09] Tom

From The Simpsons.

C:/dos, C:/dos/run, Run/dos/run

There's one from Futurama. A crippled (young) robot is holding this:

while (1){
   printf("I love mom");
}

I$ find "your_lack_of_faith_disturbing"


Only one person in a million would get that! - David Berger
also from Futurama: Believer answers the preacher-bot "That equals true". - HuBeZa
32
[+7] [2009-06-29 10:28:32] RegDwight

Perl Poetry [1]

if ("a packet hits a pocket") {
On: a;
socket(ON, A ,PORT,"")
       && the bus is interrupted as a very-last-resort
       && the address of the memory makes your 
          floppy disk, abort;

} else {

"The socket packet pocket has an";
error: to-report;
} 

if ("your cursor finds a menu item") { 
"followed by a dash"
        && "the double clicking icon";
puts: your-items-in-the-trash
        && your data is corrupted cause the 
           index("doesn't", "hash");

} else {
"Your situation is hopeless"
        && Your system's gonna crash;
} 

if ("the label on the cable") {
On-the-table, at-your-house;
Says_the; 
sub network {"is connected to the button on your mouse"};
BUT: Your-packets, want-to; 
{/tunnel to another protocol/};
thats: repeatedly-rejected; 
{/by the printer/}; "down the hall"
        && "YOUR SCREEN is all distorted";
{/by the side effects of Gauss/};
so: "your icons", in-the-window;
"are as wavy as a souse";

} else {
YOU: "may as well reboot" && "go out with a !";
CAUSE: /Sure as Im a poet/;
THIS: suckers-gonna-hang;
}

print "Seuss as a tech writer - Kevin Meltzer\n";
[1] http://www.perlmonks.org/?node=Suessified%20Perl%20Poem

33
[+6] [2009-03-20 03:32:21] Adam Liss
#!/bin/bash
# Apologies to John, Paul, George, and Ringo.
while true; do
   echo "Strawberry Fields"
done

Or:

yes "*****" "====="  # Where's my sousaphone?

34
[+6] [2009-03-19 23:45:43] Ken White

From just before last year's election (obviously referencing the former President Bush and the Presidential candidate Barack Obama and his running mate Joe Biden, for those not in the US):

Bush^3 vs. /O(s|b)ama Bi(n La)?den/ -- YOU DECIDE!

(1) if(!(Bush^3)) { WorldHasHope = TRUE; } - Oliver
Agreed. <g> I just thought the use of regexes was interesting in that context. - Ken White
35
[+6] [2009-03-19 03:55:48] Perchik

Bible reference:

first = last;  
last = first;

(1) (last,first)=(first,last) is an alternative in some dynamic languages. - Kent Fredric
(2) Any interpretation for the religiously illiterate? :) - Chris
(1) The first will be last and the last will be first. That's a rough approximation. I suppose I could go look it up -- it's something Jesus said. - thursdaysgeek
(12) But here, the first will be the last and the last will be the last, too. ;) - Nikhil Chelliah
(2) which is my version is more correct, it does an in-place swap :). With his, the second line is redundant. - Kent Fredric
(3) It hink you might want to include a temp variable :P - Joe Philllips
possibly the oldie if (first!=last) {*first ^= *last; *last ^= *first; *first ^= *last;} //assumes C99 or better - Adriano Varoli Piazza
@Adriano - you assume it's an int (or something XOR-able, anyway). - orip
Oh, this works well in VHDL :) - netom
36
[+5] [2009-03-19 05:26:44] hasen j

probably lame .. but

class Person
{
    //....
    boolean exists()
    {
        return this.thinks();
    }
    boolean thinks()
    { 
        return this.brain != null; 
    }
}

37
[+5] [2009-03-19 23:06:03] Chris

reaction = screwed? flight() : fight();

Or:

function respond(situation) {
 if (situation == screwed)
  flight();
 else
  fight();
}

38
[+5] [2009-06-29 09:53:59] alex
if ($eggs->haveHatched) {
   $chickens = count($eggs->get());
}

39
[+4] [2009-03-19 23:24:33] tsilb

select * from users where clue > 0
0 rows returned


40
[+3] [2009-03-20 04:18:24] Adam Liss
 sudo find / -name "*egg*" > basket

41
[+3] [2009-03-19 13:43:30] Steve

HermanD what about

if what.goes_around == what.comes_around
   do.good
end

42
[+2] [2009-03-19 13:40:06] Ascalonian

For the Star Wars geek...

$DO || ! $DO: try  
try: command no found

OR

if(child.eatsVegetables()) {
   child.becomeBigAndStrong();
}else{
   child.remainSmallForever();
}

OR EVEN

if(self.makeFunnyFace()) {
   if(faceMakingTime > aLongTime) {
        self.face().freeze();
    }
}

43
[+2] [2009-03-19 15:18:25] Gavin Miller

Name that tune:

if (baby.getEndDate() != null) {
  setAddress(
    new Dwelling("HeartBreak Hotel", "Lonely Street"));
}

for (int i=0; i<3; i++) {
  loneliness++;
}
mood--;

if (crowded) { // crowded always true?
  Room room = new Room();
  room.setClientelle("BROKEN_HEARTED_LOVERS")
  room.setFunction("GLOOM_AVERSION_THERAPY")
  room.getInventory().add(new Carton("Tissues"));
  room.book();
}    

if (role() == BELL_HOP && teary()) {
  global_tear_count++;
  setResidency(PERMANENT);
}  

if (role() == DESK_CLERK && getAttire.color() == Color.BLACK) {
  setResidency(PERMANENT);
}

if (recent(baby.getEndDate()) && !member()) {
  ambulate(getAddress("HeartBreak Hotel"));
}

Courtesy Gen-e-sis.com [1]

[1] http://gen-e-sis.com/2009/03/elvis-presley-heartbreak-hotel-java-snippets/

Funny that the answer is in the URL you provided. - Cory
If you couldn't figure it out by the new Dwelling command, you weren't going to anyway. - Perchik
44
[+2] [2009-03-19 10:37:06] Gordon Mackie JoanMiro
public class Person
{
    public DateTime LearningCurve { get; set; }

    public DateTime LifeExpectancy { get; set; }

    public bool Stoopid
    {
        get
        {
            return this.LearningCurve > this.LifeExpectancy;
        }
    }
}

(1) i'd replace 'stoopid' by just 'looser' - GogaRieger
45
[+2] [2010-10-14 06:38:04] User123342234
for(;$i<3;) {
     $u;
}

"I Love you forever" (although i is undefined...)

Cheesy as...but every time I see someone type "<3" regarding "love" I always say it in my head as "less than three".


46
[+2] [2011-01-12 22:08:47] Øystein
class Vader
{
    // ...
};

class Luke : public Vader
{
    // ...
};

It was when Lucas accidentally enabled RTTI that it happened...


47
[+2] [2011-01-12 22:15:57] Øystein

Yoda found one of the legitimate uses of goto in C

if(fear)
    goto Anger;

Anger:
    goto Hate;

Hate:
    goto Suffering;

Suffering:
    ; // Dark side.

48
[+2] [2011-01-13 21:15:00] Øystein

In C you could do:

float Titanic = FALSE;

49
[+1] [2011-05-04 13:00:14] osknows

from VBA (this was on a website a but can't remember which one)

Dim Everything as Object 

If Everything Is Nothing Then 
    MsgBox "This is a paradox of the universe." 
End If 

Sub and Function Names

Sub MachineGun ()
Sub Stitute () 
Sub Marine () 
Sub Human () 
Function Ality () 

Declaration Statements

Dim Lotus(1 To 3) 
Dim Wit, TheLights 
Public Exposure 
Dim Julian As Boolean, King As String, Kong As Long 
Dim BaseballCards As New Collection 
Dim Mouthful as Byte 
Dim Dewey As Decimal 
Dim DatingService As Single 
Public Nudity As Graphic 
Dim Trouble As Double 
Static Cling, Electricity 
Dim Rope as String 
Dim Bones, Bones, DryBones 
ReDim HisRights 

VBA Statements

On Error GoTo Hell 
If IsMissing(InAction) Then GoTo MilkCarton 
If IsNull(Warranty) And Void Then BuyaNew1 
Cocktail = Abs(Vodka) 
SendKeys "Because I'm locked out" 
Synergy = Whole > Application.Sum(ItsParts) 
Brightness = Array("of", "light") 
Yield = Right(OfWay, 2) 
Perfect10 = DateValue(Tiffany) 
If(IsEmpty(Head)) Then GoTo School 
WoodenHouse = Log(Cabin) 
Kill("SomeTime")Heart = Val(Entine) 
RaiseEvent Hell 
Brittney = Space(Cadet) 
Seek(AndYeShallFind) 
Lonely = Left(Out, 1) 
OnWithThe.ShowDeadActor = Dir("WoodKirby") 
Call MeACab(Hansom) 
Application.Run "Away" 
GoodIdea.Copy 
Wallpaper.Paste 
Range("HomeOnThe").Activate 
Lubricant = Shell("\Oil") 
Mismatch = Round(Sqr(Peg), 0) 
Actor = Val(Kilmer) 
Map = Rand(McNally) 
GoTo Jail 

Do Walk Backwards 
  Loop Until Christmas

50
[+1] [2009-07-05 04:36:06] Jack Leow

From the Fifth Element:

if (!kills(you)) {
    you.stronger();
}

51
[+1] [2009-08-06 20:04:10] SwDevMan81

Try this:

float or_sink = 0xB000;
int eresting_value = 1;
volatile bool sheet = TRUE;

52
[+1] [2009-11-15 11:30:49] luvieere

My definition of everything: SELECT * FROM *


Shouldn't that be SELECT * FROM ..* then? Or even SELECT * FROM ..*.* but then you'd need to set up linked servers! - Valentino Vranken
53
[+1] [2009-11-15 14:48:25] Douwe Maan
$TheQuestion = (ToBe() || !ToBe());

Just saw this is based on the same quote as the highest rated pseudo-code example in this thread...


54
[+1] [2009-04-28 17:56:17] Adam Liss

In commenting on an answer to this question [1], which asks about converting strings of hex digits to decimal, I ended by suggesting:

It's a matter of taste: 6 of one, C>>1 of another.

[1] http://stackoverflow.com/questions/788026/hex-to-decimal-conversion-kr-exercise

55
[+1] [2009-04-16 22:41:18] Adam Liss
SELECT * FROM tblMeals WHERE type = 'lunch' AND cost = 0;

0 ROWS RETURNED

56
[+1] [2009-03-19 23:37:33] MRFerocius

When everybody tells you that you like every kind of woman:

class Everyone<T> where T : IDoable
{
  T woman;

   public void haveFun()
   {
       //Cool stuff goes here!
   }
}


class Blonde : IDoable
{
   ...
}

class Brunette: IDoable
{
   ...
}

57
[+1] [2009-03-20 03:53:40] Adam Liss
void test(char *str, int max) throw(...)
{
    if (_stricmp(str, "Bathwater")
    {
        strcat_s(str, max, " Baby");
        throw(str);
    }
}

58
[+1] [2009-03-19 23:54:50] MRFerocius

This is what I like to call: To be married

//Singleton
public class Marriage
{
   static Marriage myMarriage = null;          // the best option!!
   public Woman myWoman {get; private set};    // why private!!

   private Marriage
   {
      myWoman = new Woman();    // smelly code... no new
   }

   public static Marriage getInstance()
   {
      if(myMarriage == null)
        myMarriage = new Marriage();

        return myMarriage;
   }
}

59
[+1] [2009-03-19 22:37:26] Chris

C#:

while((bouncing = paycheck())) new Action(() => {})();

JavaScript:

while((bouncing = paycheck())) (function() {})();


60
[0] [2009-03-19 13:59:49] Tim Post

oh->shit(pointer);


61
[0] [2009-03-19 07:02:53] Jonathan Parker
while(DateTime.Now < DateTime.Now.Date.AddHours(17).AddMinutes(1))
{
    HttpWebRequest myRequest =
  (HttpWebRequest)WebRequest.Create("http://stackoverflow.com/users/USERID?sort=reputationhistory");
    HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
}

Won't the while condition always evaluate to true? - Piskvor
I believe that is the point - cobbal
No, it will evaluate to true between midnight and 5pm, I believe. The ".Date" bit truncates Now to midnight. - Blorgbeard
62
[0] [2009-03-19 13:31:39] Steve

From the movie The Shining

All work and no play makes Jack a dull boy.

if (Work() and Not Play) then Jack = Dull

or

if (Work() && !Play) Jack = Dull;

(1) In times like these, it is more appropriate to say : "if (work() && !Pay) then Jack = Dull;" - ePharaoh
or even Jack = null :) - alex
63
[0] [2009-03-19 13:39:54] DanSingerman
if what.goes_around?
  what.comes_around
end

64
[0] [2009-04-27 23:39:37] nickf

Whenever using a static variable in a function in PHP, I can never get past the temptation just to write:

static $x;

[explanation] [1]

It makes the code really hard to understand, but it's totally worth it.

[1] http://en.wikipedia.org/wiki/Static%5FX

65
[0] [2010-06-07 09:47:04] hellozimi

Might be something music relative.

function dance($year) {
    if($year == 1990) {
        $this->stop();
        $this->hammer_time();
    }
}

66
[0] [2011-01-12 21:33:12] Macke
[england.sell(p) for p in pounds]

or:

map(england.sell, pounds)

67
[0] [2011-09-29 06:57:06] Ian Oakes

I saw this on a coffee cup once

Cup<T>

68
[-3] [2009-03-24 12:10:46] Omar Abid

I make money this way!!

if (pocket.money.saving() < money.currency.usd(500)) { 
   moneyrenter money = new moneyrenter(4000, money.currency.usd());
   pocket.money.charge(money);
}

Put it on a thread and you'll never get poor!!! :D :D


(2) Horrible, horrible coding practices expressed here. Ugh. I can't believe I even edited it. - Stu Thompson
69