Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Meta

Post History

50%
+0 −0
Meta Default Rules: Code Golf Answer Types

A snippet is not a valid answer A code golf answer must in general be able to take input[1] and give output. A snippet of code that is not contained in a function or program cannot take input[2], ...

posted 3mo ago by trichoplax‭  ·  edited 3mo ago by trichoplax‭

Answer
#2: Post edited by user avatar trichoplax‭ · 2024-08-26T22:04:50Z (3 months ago)
Mention STDIN
  • ## A snippet is not a valid answer
  • A code golf answer must in general be able to take input[^1] and give output. A snippet of code that is not contained in a function or program cannot take input, instead requiring the input value to be inserted directly into the code. This is not an acceptable type of answer, with the exception of programming languages for which there is no other way to take input.
  • This reflects the [insertion into the source code rule from Default Rules: Code Golf I/O](https://codegolf.codidact.com/posts/282784/282794#answer-282794).
  • [^1]:Some challenges require no input, such as some [random](https://codegolf.codidact.com/categories/49/tags/5333) output challenges or [kolmogorov-complexity](https://codegolf.codidact.com/categories/49/tags/4275) challenges. In such cases I would expect the "snippet" to work as a complete program, so these don't seem applicable here.
  • ## A snippet is not a valid answer
  • A code golf answer must in general be able to take input[^1] and give output. A snippet of code that is not contained in a function or program cannot take input[^2], instead requiring the input value to be inserted directly into the code. This is not an acceptable type of answer, with the exception of programming languages for which there is no other way to take input.
  • This reflects the [insertion into the source code rule from Default Rules: Code Golf I/O](https://codegolf.codidact.com/posts/282784/282794#answer-282794).
  • [^1]: Some challenges require no input, such as some [random](https://codegolf.codidact.com/categories/49/tags/5333) output challenges or [kolmogorov-complexity](https://codegolf.codidact.com/categories/49/tags/4275) challenges. In such cases I would expect the "snippet" to work as a complete program, so these don't seem applicable here.
  • [^2]: If a "snippet" takes input from STDIN, I would expect it to work as a complete program, so that doesn't seem applicable here.
#1: Initial revision by user avatar trichoplax‭ · 2024-08-26T22:01:27Z (3 months ago)
## A snippet is not a valid answer
A code golf answer must in general be able to take input[^1] and give output. A snippet of code that is not contained in a function or program cannot take input, instead requiring the input value to be inserted directly into the code. This is not an acceptable type of answer, with the exception of programming languages for which there is no other way to take input.

This reflects the [insertion into the source code rule from Default Rules: Code Golf I/O](https://codegolf.codidact.com/posts/282784/282794#answer-282794).


[^1]:Some challenges require no input, such as some [random](https://codegolf.codidact.com/categories/49/tags/5333) output challenges or [kolmogorov-complexity](https://codegolf.codidact.com/categories/49/tags/4275) challenges. In such cases I would expect the "snippet" to work as a complete program, so these don't seem applicable here.