Where the question does not explicitly state either way, should an answer that gives surplus output count as valid? Should this rule be different for visible characters and whitespace?

Some specific cases that sometimes come up:

  • A single trailing newline
  • Output enclosed in parentheses or quotes
  • Leading or trailing spaces per line on multiline outputs

Are there any other specific cases that should be dealt with?


2 Answers 2


No for ASCII-art challenges, possibly yes for other challenges

If the goal of the challenge is to output a specific ASCII pattern, then the challenge's requirements in terms of output must be clear and precise in the OP.

If the goal of the challenge is to evaluate an answer to something, etc., then the way it is outputted feels less important, and too strict rules on the way the output looks might penalize some languages for no meaningful reasons. But the output should still be valid according to the OP if there are precise requirements indicated, and one should not have to think a lot to understand what the output means with regards to the challenge (e.g. parentheses or brackets around a list is fine, additional meaningless chars is not).

Some languages have additional outputs that you can't do much about

I'll speak for Prolog here but this probably applies for other languages: the Prolog interpreter really likes to output true or false when you evaluate queries, even if you just want the value of a variable or if you want to print stuff to stdout with write. There's not much you can do about it and as such those kinds of additional outputs should be tolerated.

  • 3
    \$\begingroup\$ Hm, +1 for the first part and -1 for the second. Personally I think that, aside from any greetings or whatever the language spits out, the code written by the answerer should output only what is required for the challenge to STDOUT. It seems that output to STDERR is typically okay to ignore. \$\endgroup\$
    – Alex A.
    Commented Sep 3, 2015 at 16:16
  • \$\begingroup\$ I'm not a huge fan of this answer. I see nothing wrong with trailing whitespace on an ascii-art challenge, but if this was the default rule, I have to specify it in every challenge. \$\endgroup\$
    – DJMcMayhem
    Commented May 4, 2016 at 13:46

Only if the appearance is the same

So trailing spaces or newlines are okay, because they don't affect the appearance of the answer.

However, leading spaces, or visible characters anywhere, are not allowed.

Enclosing the output in quotes is not allowed.

Printing a list, however, can be done in any reasonable format (including enclosed by parentheses). This is because any default formatting requirement is equally arbitrary, so anything standard is acceptable.


You must log in to answer this question.

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