You failed everything!

-14

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 ;-)

bodqhrohro

Posted 2018-09-19T23:37:33.020

Reputation: 583

Question was closed 2018-09-20T13:57:31.807

3What's wrong with overflow errors? – Jo King – 2018-09-19T23:41:23.870

5Also, almost every answer is going to be a boring one or zero byte syntax error... – Jo King – 2018-09-19T23:45:21.770

@JoKing the focus is on making a program that is totally erroneous, not just implementing a wrong behaviour or striving from finite resources. – bodqhrohro – 2018-09-19T23:46:34.917

10@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. – xnor – 2018-09-19T23:48:52.160

1What 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"? – tsh – 2018-09-20T09:50:16.060

@tsh yes, such symbols don't count. – bodqhrohro – 2018-09-20T12:12:03.863

Answers

13

Polyglot, 0 bytes

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

Bubbler

Posted 2018-09-19T23:37:33.020

Reputation: 16 616

plenty of javas error too as "File xxx.java does not have public class xxx" or something like that – Quintec – 2018-09-20T00:11:45.287

Hey my own esolang falls under the last category, I should probably fix that – RK. – 2018-09-24T05:26:36.450

3

60% of all coding languages, 1 byte

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

To complement Bubbler's answer.

Quintec

Posted 2018-09-19T23:37:33.020

Reputation: 2 801

5Ah, so the only two answers needed. – Jo King – 2018-09-20T00:06:02.943

2

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)

Bubbler

Posted 2018-09-19T23:37:33.020

Reputation: 16 616

0

Attache, 1 byte

/

Try it online!

Crashes with:

AttacheUnimplementedError: (1:1) / is not defined for `NilClass`

Conor O'Brien

Posted 2018-09-19T23:37:33.020

Reputation: 36 228

0

Racket / Scheme / Lisp / Others?: 1 byte

) Will give an error for mismatched parentheses

Tobit

Posted 2018-09-19T23:37:33.020

Reputation: 1

0

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!

snail_

Posted 2018-09-19T23:37:33.020

Reputation: 1 982