What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

In the Markdown help page, the Code and Preformatted Text example is:

printf("goodbye world!");  /* his suicide note
                              was in C */

It also happens to be the first example of the page, and probably where a new visitor's eye will go first. I get and appreciate the joke, however I'd prefer a bit more tasteful example, even if it's as boring and predictable as "hello world!".

Actually, screw that - boring and predictable is for pages you don't want folks to read. Let's have a bit of a contest.

Rules:

  1. Best example by total score wins.
  2. One example per answer, one answer per person.
  3. Two lines per answer, ideally demonstrating whitespace preservation.
  4. Must be recognizable as code.
  5. Must be as inoffensive as possible. Examples likely to encourage readers to commit to source control and then off themselves will be disqualified. Yes, this implicitly disallows any mention of Visual Source Safe.
  6. Winner will be awarded a heaping helping of worthless Meta rep, the envy of his peers, and temporary immortality.

Thanks everyone - look forward to a revised help page shortly. –Shog9

share

locked by Shog9 Aug 13 '12 at 19:49

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

3  
That's a bit flat. –  random Aug 3 '12 at 1:35
3  
@Benjol Check the revision history, and blame Shog for everything ;) –  Yannis Aug 3 '12 at 8:39
6  
" ... and thanks for all the fish" ? –  Remou Aug 3 '12 at 14:23
4  
I first read "temporary immorality". Your pun is better. –  Gert Arnold Aug 3 '12 at 18:20
2  
Can number 3 be changed to "exactly two lines, demonstrating whitespace preservation"? That's an extremely important part of this formatting sample, and most of the examples below are one-liners. –  Josh Caswell Aug 7 '12 at 22:01
3  
Ugh, I hate it when the rules of a contest change mid-way through, @Josh. So now's my chance for revenge. Changed! –  Shog9 Aug 10 '12 at 21:59
1  
I'm quite sure we can get something nice from here. –  Matteo Italia Aug 10 '12 at 22:55
2  
Jeez guys, he's upset because he never learned to use puts() properly and was forever plagued by having to put \n at the end of every line. Have a heart. –  bobobobo Aug 11 '12 at 0:41
3  
45 answers, and I got notified for each one... Frak! –  Yannis Aug 11 '12 at 1:59
1  
@DavidHyogo This is CW, votes neither earn or cost reputation (not to mention that Meta reputation is pointless). –  Yannis Aug 11 '12 at 2:08
1  
@DavidHyogo CW stands for Community Wiki. There are a couple of answers I feel are particularly tacky, and I don't feel there's anything wrong in down voting them, there is such a thing as a bad joke. Also worth noting that both the -7 and the -8 answers were posted by people who are very familiar with Stack Exchange, and (probably) couldn't care less about the down votes. –  Yannis Aug 11 '12 at 2:44
2  
Yannis, thank you for suggesting the change. I wish I could award a bounty to this question. (Perhaps those who know me personally will understand why this pleases me so.) –  BoltClock's a Unicorn Aug 11 '12 at 3:38
4  
@BoltClock'saUnicorn You're welcome. It kinda made me mad (for a few seconds) when this was turned into a fun poll. The suicide reference was pointed out to me by a friend I recently introduced to the network, and she gave me a very stern look when she first noticed (and hasn't contributed anything to the network yet, but that's probably because she knows all too well how crazy the moderators are). It's tactless, and can be a hurtful reminder to some of us, the sooner we get rid of it the better. –  Yannis Aug 11 '12 at 3:46

63 Answers 63

up vote 126 down vote accepted
+500
printf("%d\n", 42);  /* What was the
                        question again? */
share
6  
I was going by "Zaphod Beeblebrox" on Stack Exchange for a while, love this answer ;) –  Yannis Aug 6 '12 at 20:52
for f in `ls /your/base`; do 
    test `stat -f %Su "/your/base/${f}"` != "us" && chown -fLR us "/your/base/${f}"
done
share

What about...

<html><body><a href="http://stackoverflow.com">Stack Overflow</a></body></html>

Going for more generic / less niche than C.

share
3  
How is C niche? –  Tibor Aug 11 '12 at 14:58
1  
This is really boring. You also misspelled "Stack Overflow". –  minitech Aug 11 '12 at 20:36
char* format_haiku[] = {"Indent as you please," "We optimize for code blocks"
                                                            "and beat poetry"};
share

For introduction to static methods...

Mythical ChuckNorris = null;
ChuckNorris.Method("My name evades NPEs");
share
11  
Chuck Norris doesn't point to anything... Everything points to Chuck Norris.. –  chown Aug 10 '12 at 23:44
printf("My God... It's full of stars."); //Ultimate out.
share
for (String thought : mind) { return; }  /* remember to
                                            breathe */
share
4  
Don't you have to do something with the thought? –  bobobobo Aug 11 '12 at 0:49

A little ruby?

if desire == clarity
   puts inline ? "`" + code + "`" : (" " * 4) + code
share
if(system("make me a sandwich") == EPERM) /* What? Make it yourself. */
    system("sudo make me a sandwich");    /* Okay. */
share
for (unsigned int i = 10; i >= 0; i--)
    char *foo = alloca(42);
share
puts("Press any key to continue...");
while(Key == AnyKey)
{
    Misery++; //No escape from misery..
}
share
3  
Worse tone than the suicide note. –  Robert Harvey Aug 11 '12 at 19:50
def programmer(coffee):
    return code
share
2  
I can call the function as programmer(crap) and it still returns code. –  nhahtdh Aug 12 '12 at 9:29
1  
It might not be the same code, though. –  Frédéric Hamidi Aug 12 '12 at 21:28
indent = is_code ? 4 : 0; // you can also use a tab space
share
public void DoOrDoNot() { Try(); }
[Obsolete()] public void Try() { }
share
There is only 1 kind of person in this world: 1. Those who can write markdown
                                              1. Those who can't
share
void run() {
   run() ; /* stack overflow */
}
share
3  
+1 But I'd change the comment to just /* stack overflow */ C doesn't have a concept of exception AFAIK. –  Alexandre Jasmin Aug 11 '12 at 4:32
3  
Actually, this will probably be optimized automatically as an endless loop. –  Matteo Italia Aug 11 '12 at 10:47
stop();          // Hammertime :P
share

Pun anyone?

printf("stack\n"
       "flow");
share
printf(4711 + ""); /* this code 
                    seems to smell */
share
if (has_coffee(programmer))
    programmer.can_write_code = 1;
share
while (navigator.appName == 'Microsoft Internet Explorer')
    confirm('Are you sure you don\'t want to use a different browser?');
share
my_love = "I YOU".split(" ") # split by SPACE
my_love.join(" LOVE ") # Joint by love
share
def more_lovely_and_more_temperate(thee):
    return thou(thee) if thee > A_SUMMERS_DAY else A_SUMMERS_DAY
share
for (int i = 0; i < 2; i += 1) { /* Cause two is
  a[i].aye();                       one two many */
}
share
8  
You’ve commented out your own code. –  tchrist Aug 11 '12 at 13:42

Been mulling this over for a while - is it funny?

var toBe = true, 
    question = ((toBe) || !(toBe)) ? "that" : "that";
share
2  
It took me a while to realize the second part of the joke. Good one! –  Erty Aug 10 '12 at 22:12
5  
I think the example snippet should include at least one indented line, to demonstrate that leading whitespace is preserved. –  Matthew Aug 10 '12 at 22:22
4  
You could turn the second var into whitespace to fix that. –  Niko Aug 10 '12 at 22:55
1  
thx for the suggestions guys and up votes - modified as requested! –  bUKaneer Aug 11 '12 at 8:15
1  
You could also use 0x2b here. –  Hbcdev Aug 11 '12 at 9:42
4  
I'd remove parens surrounding toBe. –  sdcvvc Aug 11 '12 at 12:56
while (1) 
    printf("Please Wait, it will take a second or two\n");
share
while (1):
  Math.rand() + " minutes remaining, please wait";  /* Extract from windows 98 copying dialog */
share
3  
What is the language? –  sdcvvc Aug 11 '12 at 13:01

Actually I loved the original. It was clever and sticky, probably due to the ubiquity of 'hello world'. I would therefore suggest the smallest of tweaks:

printf("goodbye world!");  /* his goodbye note
                              was in C */

Suggest alternates to the second goodbye - 'farewell' etc..

share
if(alpha_checksum("xkcd") == 42) // Testing alpha_checksum implementation
    printf("[PASS] -- %s succeeded","xkcd");

Can never have too much xkcd, right?

share
while (humansLeft() > 0){
   killAllHumans(); /* SkyNET coders' lab pun, just a few days 
                       before being rushed into production stage */
}
share

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .