Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Question

added 85 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite.

Write a full program, an inner function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria:

  1. Your code must be at least 1 character long.

  2. Running the original code produces x characters of output to STDOUT (or closest alternative), where 0 ≤ x < +∞.

  3. Removing any arbitrary single character from the original code results again in valid code, which produces at least x + 1 characters of output to STDOUT.

  4. Neither the original code nor the modifications may produce any error output, be to STDOUT, STDERR, syslog or elsewhere. The only exceptions to this rule are compiler warnings.

Your program may not require any flags or settings to suppress the error output.

Your program may not contain any fatal errors, even if they don't produce any output.

  1. Both the original code and the modifications must be deterministic and finish eventually (no infinite loops).

  2. Neither the original code nor the modifications may require input of any kind.

  3. Functions or snippets may not maintain any state between executions.

Considering that this task is trivial is some languages and downright impossible in others, this is a .

When voting, please take the "relative shortness" of the code into account, i.e., a shorter answer should be considered more creative than a longer answer in the same language.

Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite.

Write a full program, an inner function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria:

  1. Your code must be at least 1 character long.

  2. Running the original code produces x characters of output to STDOUT (or closest alternative), where 0 ≤ x < +∞.

  3. Removing any arbitrary single character from the original code results again in valid code, which produces at least x + 1 characters of output to STDOUT.

  4. Neither the original code nor the modifications may produce any error output, be to STDOUT, STDERR, syslog or elsewhere. The only exceptions to this rule are compiler warnings.

Your program may not require any flags or settings to suppress the error output.

Your program may not contain any fatal errors, even if they don't produce any output.

  1. Both the original code and the modifications must be deterministic and finish eventually (no infinite loops).

  2. Functions or snippets may not maintain any state between executions.

Considering that this task is trivial is some languages and downright impossible in others, this is a .

When voting, please take the "relative shortness" of the code into account, i.e., a shorter answer should be considered more creative than a longer answer in the same language.

Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite.

Write a full program, an inner function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria:

  1. Your code must be at least 1 character long.

  2. Running the original code produces x characters of output to STDOUT (or closest alternative), where 0 ≤ x < +∞.

  3. Removing any arbitrary single character from the original code results again in valid code, which produces at least x + 1 characters of output to STDOUT.

  4. Neither the original code nor the modifications may produce any error output, be to STDOUT, STDERR, syslog or elsewhere. The only exceptions to this rule are compiler warnings.

Your program may not require any flags or settings to suppress the error output.

Your program may not contain any fatal errors, even if they don't produce any output.

  1. Both the original code and the modifications must be deterministic and finish eventually (no infinite loops).

  2. Neither the original code nor the modifications may require input of any kind.

  3. Functions or snippets may not maintain any state between executions.

Considering that this task is trivial is some languages and downright impossible in others, this is a .

When voting, please take the "relative shortness" of the code into account, i.e., a shorter answer should be considered more creative than a longer answer in the same language.

Tweeted twitter.com/#!/StackCodeGolf/status/613598748229402624
added 63 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite.

Write a full program, an inner function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria:

  1. Your code must be at least 1 character long.

  2. Running the original code produces x characters of output to STDOUT (or closest alternative), where 0 ≤ x < +∞.

  3. Removing any single characterany arbitrary single character from the original code results again in valid code, which produces at least x + 1 characters of output to STDOUT.

  4. Neither the original code nor the modifications may produce any error output, be to STDOUT, STDERR, syslog or elsewhere. The only exceptions to this rule are compiler warnings.

Your program may not require any flags or settings to suppress the error output.

Your program may not contain any fatal errors, even if they don't produce any output.

  1. Both the original code and the modifications must be deterministic and finish eventually (no infinite loops).

  2. Functions or snippets may not maintain any state between executions.

Considering that this task is trivial is some languages and downright impossible in others, this is a .

When voting, please take the "relative shortness" of the code into account, i.e., a shorter answer should be considered more creative than a longer answer in the same language.

Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite.

Write a full program, an inner function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria:

  1. Running the original code produces x characters of output to STDOUT (or closest alternative), where 0 ≤ x < +∞.

  2. Removing any single character from the original code results again in valid code, which produces at least x + 1 characters of output to STDOUT.

  3. Neither the original code nor the modifications may produce any error output, be to STDOUT, STDERR, syslog or elsewhere. The only exceptions to this rule are compiler warnings.

Your program may not require any flags or settings to suppress the error output.

Your program may not contain any fatal errors, even if they don't produce any output.

  1. Both the original code and the modifications must be deterministic and finish eventually (no infinite loops).

  2. Functions or snippets may not maintain any state between executions.

Considering that this task is trivial is some languages and downright impossible in others, this is a .

When voting, please take the "relative shortness" of the code into account, i.e., a shorter answer should be considered more creative than a longer answer in the same language.

Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite.

Write a full program, an inner function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria:

  1. Your code must be at least 1 character long.

  2. Running the original code produces x characters of output to STDOUT (or closest alternative), where 0 ≤ x < +∞.

  3. Removing any arbitrary single character from the original code results again in valid code, which produces at least x + 1 characters of output to STDOUT.

  4. Neither the original code nor the modifications may produce any error output, be to STDOUT, STDERR, syslog or elsewhere. The only exceptions to this rule are compiler warnings.

Your program may not require any flags or settings to suppress the error output.

Your program may not contain any fatal errors, even if they don't produce any output.

  1. Both the original code and the modifications must be deterministic and finish eventually (no infinite loops).

  2. Functions or snippets may not maintain any state between executions.

Considering that this task is trivial is some languages and downright impossible in others, this is a .

When voting, please take the "relative shortness" of the code into account, i.e., a shorter answer should be considered more creative than a longer answer in the same language.

added 11 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830
Loading
added 117 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830
Loading
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830
Loading

AltStyle によって変換されたページ (->オリジナル) /