-14
\$\begingroup\$

Your goal is simple: to fail everything. More precisely, you should write the shortest code that triggers a compilation/interpretation error, or a runtime error.

What does not count

  • Failing with symbols that are not covered by the language syntax and are meant to appear only in string literals, comments and other ways to include non-executable data in the code, or are not meant to appear in the code at all
  • Warnings and notices that don't prevent successful compilation or execution
  • Overflow related errors: infinite loops, recursion limits reaching, stack overflows, out-of-memory errors and so on

This is , so the shortest code in bytes wins!

By the way, this is probably the only challenge where non-esoterical languages can beat esoterical ones ;-)

\$\endgroup\$

closed as unclear what you're asking by AdmBorkBork, Sriotchilism O'Zaic, Luis felipe De jesus Munoz, Jonathan Frech, Don Thousand Sep 20 '18 at 13:57

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.

  • 3
    \$\begingroup\$ What's wrong with overflow errors? \$\endgroup\$ – Jo King Sep 19 '18 at 23:41
  • 5
    \$\begingroup\$ Also, almost every answer is going to be a boring one or zero byte syntax error... \$\endgroup\$ – Jo King Sep 19 '18 at 23:45
  • \$\begingroup\$ @JoKing the focus is on making a program that is totally erroneous, not just implementing a wrong behaviour or striving from finite resources. \$\endgroup\$ – bodqhrohro Sep 19 '18 at 23:46
  • 10
    \$\begingroup\$ @bodqhrohro The way code golf works is that people post the shortest answer they can find that follows the rules. Whatever you think the focus is meant to be, the winningest answers are blank programs or one-characters syntax errors, so that's what people will post. \$\endgroup\$ – xnor Sep 19 '18 at 23:48
  • 1
    \$\begingroup\$ What do you mean by "symbols that are not covered by the language syntax"? Is a symbol only valid in string literal considered "not covered by the language syntax"? \$\endgroup\$ – tsh Sep 20 '18 at 9:50
13
\$\begingroup\$

Polyglot, 0 bytes

This is a list of languages where an empty program gives an error.

\$\endgroup\$
  • \$\begingroup\$ plenty of javas error too as "File xxx.java does not have public class xxx" or something like that \$\endgroup\$ – Quintec Sep 20 '18 at 0:11
  • \$\begingroup\$ Hey my own esolang falls under the last category, I should probably fix that \$\endgroup\$ – RK. Sep 24 '18 at 5:26
3
\$\begingroup\$

60% of all coding languages, 1 byte

+ or - or / or * or % or any valid token etc.

To complement Bubbler's answer.

\$\endgroup\$
  • 5
    \$\begingroup\$ Ah, so the only two answers needed. \$\endgroup\$ – Jo King Sep 20 '18 at 0:06
2
\$\begingroup\$

Polyglot, 1 byte

a

This gives undefined identifier error in many interpreted languages.

  • Python
  • Javascript
  • APL
  • J
  • (Add language here)

Polyglot, 1 byte

+

This gives syntax error in many languages.

  • (Add language here)

Polyglot, 1 byte

'

This gives open string literal error in many languages.

  • (Add language here)

Polyglot, 1 byte

[

This gives open bracket error in many languages. (Feel free to change to ( or { if some languages specifically error with it.)

  • (Add language here)
\$\endgroup\$
0
\$\begingroup\$

Attache, 1 byte

/

Try it online!

Crashes with:

AttacheUnimplementedError: (1:1) / is not defined for `NilClass`
\$\endgroup\$
0
\$\begingroup\$

Racket / Scheme / Lisp / Others?: 1 byte

) Will give an error for mismatched parentheses

\$\endgroup\$
0
\$\begingroup\$

Ahead, 1 byte

/

Tries to do 0/0. Reference implementation on TIO will fail with:

Exception in thread "main" java.lang.ArithmeticException: / by zero
        at ajc2.ahead.Head.doCell(Head.kt:148)
        at ajc2.ahead.Head.step(Head.kt:31)
        at ajc2.ahead.Runner.go(Runner.kt:6)
        at ajc2.ahead.MainKt.main(Main.kt:13)

Try it online!

\$\endgroup\$

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