2
\$\begingroup\$

This is my first contest, so please tell me what I can do to improve.

The object of this contest is to write program lines in your language of choice that are both valid code and self-descriptive in English, such as this Golfscript program:

This program outputs 4 twice.

You may use any language features, libraries, #defines, etc. that you want; however, a setup must not be over 10 lines (no, you can't cheat using ; or any such line separator :P).

The program with the most upvotes by midnight on October 1st wins.

\$\endgroup\$
  • 3
    \$\begingroup\$ I'd say you may want to reword 'Must not be over 10 lines' since technically a full-blown program can be on one continuous line. Maybe adding a character restriction per line or overall character limit. \$\endgroup\$ – Xrylite Sep 20 '14 at 0:20
  • \$\begingroup\$ 1. I'm not sure what the line limit is going to accomplish. As a fellow GolfScriptling, you know hat some languages aren't even organized by lines. 2. Self-descriptive code is the exact opposite of obfuscation. 3. The code-challenge tag is only for questions that are not covered by code-golf, popularity-contest, etc. \$\endgroup\$ – Dennis Sep 20 '14 at 1:13
  • 2
    \$\begingroup\$ is any language allowed? \$\endgroup\$ – user25169 Sep 20 '14 at 7:21
  • \$\begingroup\$ This was a bad idea from the start, I'll admit. I just wanted to do something like the "aphorism" challenge, but I didn't want a duplicate. \$\endgroup\$ – Josiah Winslow Sep 20 '14 at 14:53
7
\$\begingroup\$

Python

# This "program" does nothing and assumes "valid code" means it doesn't throw an error.

You might want to tighten up the rules a bit.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

C

This was too easy...

#define This int
#define program main(){
#define prints printf(
#define and );
#define exits }

This program prints "Hello world!" and exits

English

This program outputs 99 verses in the manner:
"N bottles of beer on the wall
N bottles of beer
Take one down and pass it around
N-1 bottles of beer on the wall",
where N is replaced by numbers from 99 to 1
and 1-1=0 is replaced by "No more".
After that there is hundredth verse:
"No more bottles of beer on the wall
No more bottles of beer
Go to the store and buy some more
99 bottles of beer on the wall".
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

OS X say

say whatever you want man!
| improve this answer | |
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.