-11
\$\begingroup\$

Write the shortest possible program or function in your language that does nothing. Specifically, it must take no input or ignore its input, and must not produce any output in any legal output method for this site.

The shortest code for each language wins.

\$\endgroup\$

closed as unclear what you're asking by fəˈnɛtɪk, xnor, Xcali, Sriotchilism O'Zaic, caird coinheringaahing Oct 7 at 6:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Possible duplicate of Shortest infinite loop producing no output \$\endgroup\$ – fəˈnɛtɪk Oct 7 at 0:49
  • 11
    \$\begingroup\$ Remember that program return codes are a valid method of producing output, so no program can be a valid answer on any operating system with return codes. \$\endgroup\$ – feersum Oct 7 at 0:57
  • \$\begingroup\$ Does a newline count as an output? \$\endgroup\$ – A _ Oct 7 at 1:06
  • \$\begingroup\$ @feersum What if the language provides no mechanism to return a value to the OS? \$\endgroup\$ – gastropner Oct 7 at 1:18
  • 1
    \$\begingroup\$ @gastropner A real implementation of a language has to exist for a answer to be valid. I doubt most languages run on any operating systems that don't have return codes. \$\endgroup\$ – feersum Oct 7 at 1:46
2
\$\begingroup\$

PHP, 0 bytes

Try it online!

Run like this: php -r ""

An empty PHP file has the same result too.

\$\endgroup\$
  • \$\begingroup\$ Also works in dg and Del|m|t and Dodos. \$\endgroup\$ – A _ Oct 7 at 1:55
  • \$\begingroup\$ Also works in evil and Element and Elixir. \$\endgroup\$ – A _ Oct 7 at 1:56
  • \$\begingroup\$ Also works in Emmental and es and Factor. \$\endgroup\$ – A _ Oct 7 at 1:57
  • \$\begingroup\$ Also works in FALSE and Fission and Forth. \$\endgroup\$ – A _ Oct 7 at 1:58
  • \$\begingroup\$ @A_ I made it community wiki, if you like, you can edit and add all of those. \$\endgroup\$ – Night2 Oct 7 at 4:38
2
\$\begingroup\$

Java, 49 5 bytes

v->{}

TIO!

\$\endgroup\$
1
\$\begingroup\$

Keg, 0 bytes

Try it online!

Obligatory Keg 0-byter. Does nothing at all.

  • Also works in dc and ecndpcaalrlp and ///.
  • Also works in 33 , 2sable
  • Also works in Mathgolf, ;#+ and ABC
  • Also works in Python
  • Obviously, this works in quite a lot of languages
\$\endgroup\$
1
\$\begingroup\$

Conway's Game of Life, 13 bytes (7 cells)

2b2o$3bo$3o$o
\$\endgroup\$
  • 5
    \$\begingroup\$ Where and how can this be run? \$\endgroup\$ – Sriotchilism O'Zaic Oct 7 at 3:55
1
\$\begingroup\$

Windows Notepad, 3 keystrokes

I know this is not a language.

[^A][Backspace]
\$\endgroup\$
  • \$\begingroup\$ Also works in VSCode though. \$\endgroup\$ – A _ Oct 7 at 3:39
0
\$\begingroup\$

C, 5 or 10 bytes

Any arguments are ignored, of course, and strictly speaking the function does not produce any output, since it does nothing... it just so happens that in the place where outputs are looked for by a caller, something will already be.

f(){}

If that is too cheeky, you could do

void f(){}

instead.

\$\endgroup\$
  • \$\begingroup\$ f(){} is a function that returns an int. \$\endgroup\$ – feersum Oct 7 at 0:57
  • 1
    \$\begingroup\$ @feersum Which is exactly what my caveat was about, and the alternative version. \$\endgroup\$ – gastropner Oct 7 at 0:59
0
\$\begingroup\$

Taxi, 48 bytes

Go to the Taxi Garage:w 1 l 2 r 1 r 1 r 1 l 1 r.

Try it online!

Drive around in a loop back to the Taxi garage.

Ungolfed:

Go to the Taxi Garage: west 1st left 2nd right 1st right 1st right 1st left 1st right.
\$\endgroup\$

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