g | x | w | all
Bytes Lang Time Link
nanSwift 6250301T190526ZmacOSist
028Tcl170616T153430Zsergiol
394Bespoke250216T113234ZJosiah W
012UiuaSBCS240728T054630ZEurope20
069Pascal240727T180000ZKai Burg
nanJavaScript230622T174108ZNikolay
032Perl 32 Bytes230622T170942ZWallace
028x8616 machine code190122T194034Z640KB
356KonamiCode211112T173059ZGinger
105Vyxal210903T214521Zemanresu
nan210226T125147Zuser1006
071F#210127T091001Zroot
nanPython 3210127T172935ZM Virts
027BRASCA210127T091953ZSjoerdPe
023Keg190820T235209Zuser8505
01405AB1E201210T235949ZMakonede
036Batch200426T085956ZScriptKi
nanAhead200215T090457Zsnail_
3331Python 3200212T162404ZDion
051JavaScript190819T162640ZLukas
017W d191227T130114Zuser8505
nanW191227T124918Zuser8505
024Underload191230T164703ZMadison
nanRuby191227T215042Zhistocra
037Wren191227T135033Zuser8505
nanPip180824T155747ZDLosc
315JavaScript190903T124316ZSagittar
02433190905T210054ZTheOnlyM
044ink190905T193122ZSara J
nan05AB1E legacy180821T140201ZKevin Cr
018Zsh190821T032432Zroblogic
nanx86 and x64_64 machine language on Linux180324T034143Zceilingc
nanRust190821T074245ZElcan
092Assembly MIPS190821T023608ZAndrew B
016Stax190821T000154Zrecursiv
nanEmacs Lisp190819T190628ZJordon B
030Python 2190124T170619ZTriggern
049PowerShell181024T220303ZGMills
nanJstx180401T022326ZQuantum6
215K4181024T173144ZThaufeki
055JavaScript181025T005014Zdarrylye
051Julia 1.0181024T152650Zgggg
191Pepe180823T110714ZRedClove
029Batch181022T024609ZMilkyWay
402R170612T074224Zrturnbul
nanSOGL170608T133758Zdzaima
nanRust180821T161343ZFriz64
030Lua170608T172754Zeniallat
039Common Lisp180821T131014Zunivalen
nanClean180821T035727ZΟurous
042Processing 3180820T225800ZRobert S
033Python 3180820T015325ZAndiChin
026Forth gforth180820T122052Zreffu
108Java 8180330T114200ZO.O.Bala
nanKotlin180401T015235ZJohnWell
028J180401T003315ZBolce Bu
215Yabasic180330T014027ZTaylor R
nanOCaml180324T125506ZH. Ritti
195Windows .BAT180324T014416Zl4m2
245Node.js170608T133058ZArnauld
nanFortran GFortran180324T004109Zrafa1111
nanSmileBASIC180324T000438Z12Me21
032F#180323T235601ZCiaran_M
022TSQL170702T021535ZWORNG AL
025Swift 50 bytes170609T212715ZAlexande
265Haskell170608T134745ZLaikoni
043C170608T150547ZSteadybo
024PHP170615T011145ZFPCSJame
nanOperation Flashpoint scripting language170614T221912ZSteadybo
020Alice170609T034702ZNitrodon
205Batch170612T140611Zericw314
042C170612T123042Zugoren
nanKotlin170612T103659ZEnderman
nanJavaScript 58 bytes170609T122939ZBharath
023Mathematica170612T001754ZIan Mill
026PowerShell170608T165030Zcolsw
195Rexx Regina170610T200414Ztheblitz
028SmileBASIC 3170611T042333Zsnail_
060C170611T035351ZGarhoogi
083Java 6170611T025150Ztsunko
nan170610T071430Zgmatht
nan170610T235900ZMaria
nanJS ES5170610T235606Zuser7070
nanPyth170610T230421ZJim
175APL Dyalog170609T120916ZAdá
021LOLCODE170610T210147ZCurtis P
066C++170610T203154ZJonas
205Micro170609T131657Zraddish0
nanLua170610T173045ZTrebuche
030Julia170610T052443Zeaglgene
043x8664 Binary Code with Linux system calls170610T020626ZDavid Zh
027C Preprocessor170609T213451ZGovind P
033WinDBG Windows XP/Vista Local Kernel Debugging170609T194020Zmilk
nanRuby170608T174606Zdaniero
105Jelly170609T160753ZErik the
028Kitanai170609T123610ZSygmei
028APL170609T110059ZLobachev
nanC#170608T132858ZTheLetha
022Japt170608T132352ZTom
038Ruby170609T052542Zmarmelad
032sed170609T012752Zapricot
019TeX170608T215854Zcp.fe.cp
076Go170608T204502ZAniSkywa
244TIBASIC170608T212207ZScott Mi
012Jelly170608T134939ZChristia
nanPerl 5170608T174441ZChris
nan170608T130924ZTezra
024Pyth170608T155435ZKarlKast
034CJam170608T154451ZBusiness
072AWK170608T153625ZRobert B
025Arcplus170608T141917ZMayube
215Aceto170608T143307ZL3viatha
025><>170608T133811ZAGourd
026PHP170608T132344ZChristop
028Octave170608T131413ZStewie G

Swift 6, 56 ÷ 2 = 28 bytes!

print("Hello World!")
fatalError("Goodbye Cruel World!")

...there's literally nothing interesting to say about this.

Swift 6 (no bonus), 34 bytes

[print("Goodbye Cruel World!")][1]

Tcl, 28 bytes

error "Goodbye cruel World!"

Try it online!

Bespoke, 394 bytes

say it:bye-bye
say it loudly anywhere you go
goodbye,people;you are s-o mean and rud-e-e-e
bye-bye;I m depressed
why,oh god,is this world so cruel
not for a nanosecond I get any O.K moments
get out;u r just bad,an abject mockery
why,oh god,is this world so cruel
one day,I go
I get to obtain petrol,get to obtain lighters
and bur-n-n-n it down til it topples
a blazing inferno,cities go to dust

Prints GooDBye CrueL worLD! and exits with a Stack underflow. error.

UiuaSBCS, Score: 12

⍤"Goodbye Cruel World!"0

Try it here!

errors if the condition is anything but 1. Here, because it is 0, it throws an error with the message Goodbye Cruel World!.

Pascal, 69 B

Reading from a file that is not in inspection mode constitutes an error (get(output)). However, it is not guaranteed that this “crashes” the program.

program p(output);begin write('Goodbye Cruel World!');get(output)end.

JavaScript, 51 / 2 = 25.5! 43 / 2 = 21.5!

"Goodbye Cruel World!"(console.log("Hello World!"))

console.log can be changed to alert and ("") to backticks saving 8 bytes (but I'm not sure this is eligible):

"Goodbye Cruel World!"(alert`Hello World!`)

Perl 32 Bytes

Try it online!

print"Goodbye Cruel World!";1/0;

x86-16 machine code, PC DOS, 28 bytes

00000000: b409 ba07 01cd 2147 6f6f 6462 7965 2043  ......!Goodbye C
00000010: 7275 656c 2057 6f72 6c64 2124            ruel World!$

Unassembled listing:

B4 09       MOV  AH, 9              ; DOS display string function
BA 0107     MOV  DX, OFFSET BYE     ; load address of message
CD 21       INT  21H                ; print and say goodbye
       BYE  DB  'Goodbye Cruel World!$'

Explanation

This will first display the string below without terminating the program. It will then continue to execute the subsequent memory contents as random CPU instructions, including jumps to other code, hardware, etc.

This will likely crash DOS to the point that a hard reset (power cycle) of your PC will be required.

KonamiCode, 356 bytes

v(^^^^^^^>^)>((>))v(^>^>^)>((>))v(^>^>^)>((>))v(^>>)>((>))v(^^^^^^^^^>^^^^^^^^)>((>))v(^>^^>^)>((>))v(^>>^)>((>))v(^^^>^^)>((>))v(^^^^^^^^^>^^^^^^^^^)>((>))v(^>^>^^^^)>((>))v(^>^>^^^^^^^)>((>))v(^>>^)>((>))v(^>>^^^^^^^^)>((>))v(^^^>^^)>((>))v(^>^>^^^^^^^^^)>((>))v(^>^>^)>((>))v(^>^>^^^^)>((>))v(^>>^^^^^^^^)>((>))v(^>>)>((>))v(^^^>^^^)>(>)L(>)<<>((>))B(>)

Sadly, the fact that we have to encode "Goodbye, cruel world!" makes this very long.

Vyxal, 10.5! bytes

`ƛ⁋Ṗ⊍ Crꜝ∞ ƛ€!`kh\!+←

Try it Online!

`...`        # Push 'Goodbye Cruel World!' as a compressed string
     kh\!+,  # Push 'Hello World!', which will be implicitly output even though the program errors.      
           ← # Crash by accessing a nonexistent variable, Vyxal logs the stack on erroring

JavaScript: 24.5!

alert('Hello World!');throw'Goodbye Cruel World!'

If alert does not count as a valid output function, then I will use console.log (3 extra points).

F#, 71 bytes

[<EntryPoint>]
let main a=
  printfn"Goodbye Cruel World!"
  a.[0]|>int

Try it online!

The function main takes an array of strings a and has a return value of integer. The program attempts to get index 0 of the arguments, even though there are no arguments. The |>int converts a.[0] to an int, or otherwise, the program wouldn't compile because the return value has to be int. The boilerplate code [<EntryPoint>] kind of made it necessarily long but you, unfortunately, cannot get rid of it.

Python 3, Score: 43/2=21.5!

+print("Hello"+"Goodbye Cruel World!"[-7:])

Try it online!

BRASCA, 33 29 28 27 bytes

-4 bytes
-2 bytes thanks to Command Master

`!dlroW leurC eybdooG`[o]~o

Try it online!

Explanation

`!dlroW leurC eybdooG`              - Push "Goodbye Cruel World!", reversed
                      [o]           - Output the stack
                         ~o        - Attempt to print a character with codepoint -1, which crashes.

Keg, 23 bytes

Basically a port of the ><> answer.

\!dlroW leurC eybdooG{,

Explanation

\!dlroW leurC eybdooG#Push "Goodbye Cruel World!"
{,#                   Forever, pop and output the top of the stack

This halts by popping an empty stack.

Keg, 13 bytes

Without the -rt flag that you can actually try it online.

“⑮I⅍Gc¡“,\!,/

Try it online!

Keg -rt, 14 bytes

(Doesn't work on TIO as Keg needs a pull)

/00,\!,“⑮I⅍Gc¡

Try it online!

Explanation

       “⑮I⅍Gc¡# Define a space-separated string "Goodble Cruel World"
      ,        # Print it as a character
   ,\!         # Print an exclamation mark
/00            # Perform 0-division, which is an undefined operation

05AB1E, score 14.5 14!

”Ÿ™‚ï!”,.•1{ø{β?Õ&>₅₁\•™'!«ι

Try it online!

Batch, 36 bytes

Exits with a CRASH!! (the two trailing newlines must not be removed)

@echo(Goodbye Cruel World!
@call ^


Ahead, 36/2 = 18 bytes!

Prints then divides by zero. The error contents contain a copy of the codeboard, so the string Goodbye Cruel World! will appear.

"!dlroW olleH"W/Goodbye Cruel World!

Try it online!

Ahead, 24 bytes

Same but doesn't get the bonus.

"!dlroW leurC eybdooG"W/

Try it online!

Python 3, 33 31

print('Goodbye Cruel World!')
e

very basic

Try it online!

Python 3, 23! 19!

print('Hello World!')
Goodbye Cruel World!

Try it online!

JavaScript, 51 bytes, Real Crash

[console.log("Goodbye Cruel World!"),...Array(1e9)]

W d, 17 bytes

Weirdly enough, I got the same bytecount when I avoided the bonus!

.≈ò♠┐M*óö↑á☼r↕Qá╠%·

Unpacked:

CD(IdK815Ak]T&:Q>`P/

After string-decompression:

Goodbye Cruel World!"P/

Explanation

"Goodbye Cruel World!"   % Define the string "Goodbye Cruel World!"
                      P  % Output the string to STDOUT with a newline
                       / % Divide 0 by the string, which causes an error.
                         % We can't do 0-division because in W,
                         % 0-division is defined as positive infinity.

W, 34 33/2 = 16.5 bytes

s|x@`p"Goodbye Cruel"" World!"P+/

Explanation

"Hello"p                            % Print "Hello" to STDOUT without a newline
                       " World!"P   % Output " World" to STDOUT with a newline
        "Goodbye Cruel"          +  % Join "Goodbye Cruel" with the string
                                  / % Perform division upon strings (which is undefined behavior)
                                    % Join the two different snippets of code into a single snippet

The error message provides the source code for debugging purposes.

Underload, 24 bytes

(Goodbye Cruel World!)S*

Try it Online!

(Goodbye Cruel World!)S | Puts "Goodbye Cruel World!" onto the stack, then pops and prints it.
*                       | Tries to concatenate two items of an empty stack.

Ruby, 41 bytes / 2 = 20.5 bytes!

"Goodbye Cruel World!"&$><<"Hello World!"

Try it online!

$><< is a very useful method of output for Ruby golfing--syntax around it is very forgiving("Goodbye Cruel World!"&puts"Hello World!" would be a syntax error, for example, rather than the runtime exception we need), and << has medium precedence so we can control when it executes more freely.

Wren, 37 bytes

-System.print("Goodbye Cruel World!")

Try it online!

Explanation

              "Goodbye Cruel World!"  // Define the string "Goodbye Cruel World!"
 System.print(                      ) // Output the string to STDOUT
-                                     // Apply negation upon the returned string
                                      // which is "Hello World". Negation on strings
                              // isn't defined in Wren.

Pip, 19.5 18! (36 bytes/2)

O"Hello";V"Goodbye Cruel".P" World!"

Try it online!

Outputs Hello without a newline; then prints World!, and finally concatenates and tries to evaluate Goodbye Cruel World! as code. This fails because the unary operator ! needs an operand, leading to the error message

Hit end of tokens while parsing expression
Fatal parsing error while evaluating Goodbye Cruel World!
Fatal error during execution, program terminated.

JavaScript, 31.5! (does this count?)

(c=console).log("Hello World!");c.error("Goodbye Cruel World!")

Output:

Hello World!          //is printed to stdout
Goodbye Cruel World!  //is printed to stderr
undefined

JavaScript, 37

console.log("Goodbye Cruel World!")=0

Output:

Goodbye Cruel World!
ReferenceError: Invalid left-hand side in assignment

33, 24 bytes

"Goodbye Cruel World!"pd

Try it online!

Simple case. Prints Goodbye Cruel World! then crashes with a floating-point exception caused by the d instruction, which tries to divide 0 by 0. I could just put a character in that 33 doesn't recognise, but where's the fun in that?

ink, 44! bytes

VAR a="Goodbye Cruel World!"
Hello World!->a

Try it online!

Funnily enough, even though variables created in VAR declarations are usually always available even if the VAR statement is unreachable, this program only "works" if that VAR statement comes before the divert - if it doesn't, it's a syntax error instead.

05AB1E (legacy), score: 13.5 13 11.5 (23 bytes / 2 for bonus)

…Ÿ™‚ï!“‚¿bye±ƒuel‚ï!“.ǝ

Try it online.

-1.5 (-3 bytes) thanks to @Grimy.

Outputs in full lowercase.

05AB1E (legacy) is unable to exit with an error as far as I know (unless there is a bug in its source code), so instead this will print hello world! to STDOUT and goodbye cruel world! to STDERR.

Explanation:

…                 # Three lowercase dictionary-compressed words with space delimiter
 Ÿ™               #  "hello"
   ‚ï             #  "world"
     !            #  Literal "!"
“             “   # Push dictionary string in lowercase with automatic space-delimiter:
 ‚¿bye±ƒuel‚ï!    #  "goodbye cruel world!"
               .ǝ # Print to STDERR
                  # And print the top of the stack to STDOUT implicitly

See this 05AB1E this of mine (section How to use the dictionary?) to understand why …Ÿ™‚ï! is hello world! and “‚¿bye±ƒuel‚ï!“ is goodbye cruel world!.


05AB1E, score: 11.5 (23 bytes / 2 for bonus)

…Ÿ™‚ï!,“‚¿bye±ƒuel‚ï!“F

Unlike the legacy version, the new version is able to error out sometimes. The difference between the above program are:

(RuntimeError) Could not convert goodbye cruel world! to integer.

Zsh, 18!

36/2 bytes, including hello world! for extra credit. Try it online!

echo hello world!
goodbye\ cruel\ $_

NB: The identifier $_ doesn't work with <<< because <<< runs in a sub-shell. Example

x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30!

00:       e8 20 00 00 00          call  0x25
05:       48 65 6c 6c 6f 20 57    "Hello World!Goodbye Cruel World!"
          6f 72 6c 64 21 47 6f
          6f 64 62 79 65 20 43
          72 75 65 6c 20 57 6f
          72 6c 64 21
25:       59                      pop   %ecx
26:       6a 01                   push  $0x1
28:       5b                      pop   %ebx
29:       6a 0c                   push  $0xc
2b:       5a                      pop   %edx
2c:       6a 04                   push  $0x4
2e:       58                      pop   %eax
2f:       cd 80                   int   $0x80
31:       01 c0                   add   %eax,%ecx
33:       b3 02                   mov   $0x2,%bl
35:       b2 14                   mov   $0x14,%dl
37:       2c 08                   sub   $0x8,%al
39:       cd 80                   int   $0x80
3b:       6e                      outsb  %ds:(%esi),(%dx)

Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

const char main[]="\xe8 \0\0\0Hello World!Goodbye Cruel World!Yj\1[j\fZj\4X\xcd\x80\1\xc1\xb3\2\xb2\24,\b\xcd\x80n";

EDIT: TIO link now works again.

Rust, (83) 41.5! bytes

fn main(){print!("Hello World!");"".bytes().nth(1).expect("Goodbye Cruel World!");}

Try it online!

Rust, 41 bytes

fn main(){print!("Goodbye Cruel World!")}

Try it online!

Assembly (MIPS, SPIM), 97 92 bytes

.data
a: .asciiz "Goodbye Cruel World!"
.text
.globl main
main:
li $2 4
la $4 a
syscall
j $0

Try it online!

Not gonna lie, i haven't touched MIPS in a long time. Plus i'm not familiar with what shortcuts i can use with SPIM, but i'm satisfied.
For those of you not familiar with mips, the dumbed down version: data declares allocated data (obviously) which in our case is the ascii string. Text is our function space, and main is our main method. Interestingly, mips lacks a native output, so we need a system call for this.
li $2 4 means load immediate, or put a number in this register. In this case 4, to the $V0 register. This will tell the system call what it's doing, and 4 roughly means "print text"

la $4 a Next, we load the address of our text into a register so that the system call knows what it's printing.

Then we call syscall our system call.
To break it, i jump to 0 which is essentially a goto. 0 is not a valid target, so it errors. This saves 5 bytes over divide by zero.

Edit: Safe Alternative 112 Bytes.

Try it online!

If you're not fond of a program running until it essentially overflows the stack, this will create an exception and exit safely thereafter. This one does so by trying to read from a misaligned location, which is a few bytes shorter than divide by zero.

Stax, 16 bytes

ö╞îö~l%♀~K5╓╖]Æ(

Run and debug it

It's a compressed string literal, followed by a packed Qe. Q peeks and outputs, and e is eval, which fails.

Emacs Lisp, 55/2=27.5 bytes!

(error(and(princ"Hello World!")"Goodbye Cruel World!"))

Usage:

$ emacs --batch --eval '(error(and(princ"Hello World!")"Goodbye Cruel World!"))'

Output:

Goodbye Cruel World! # to stderr
Hello World! # to stdout, exits with non zero

Python 2, 30 bytes

print"Goodbye Cruel World";1/0

Try it online!

Similar to the Python 3 answer, this prints then tries to evaluate an invalid expression, exiting with a ZeroDivisionError.

PowerShell, 49 bytes

'Goodbye Cruel World!';[Environment]::FailFast(0)

Try it online!

Prints Goodbye Cruel World! and crashes. Uses the .NET built-in FailFast() feature.

Jstx, 22 bytes / 2 = score 11!

₧P4☼♫╗ååÿΔ{îª2╡¬ûÿ~í£▬

Try it online!

K4, 21.5

-1"Hello World!";.:`$"Goodbye Cruel World!"

Does not work on variants of K available on TiO, as casting to symbol from string has not yet been implemented

The program prints "Hello, World", then attempts to get the value to which the symbol `Goodbye Cruel World has been set. No value has been set resulting in an error.

q)k)-1"Hello World!";.:`$"Goodbye Cruel World!"
Hello World!
'Goodbye Cruel World!

JavaScript, 55 bytes, score 27.5!

console.log('Hello World!')
throw'Goodbye Cruel World!'

Julia 1.0, 51 bytes long, score 25.5!

print("Hello World!");error("Goodbye Cruel World!")

Try it online!

Pepe, 195 191 bytes

Saved 4 bytes thanks to u_ndefined.

 reeEeeeEEErEeEEeEEEEreeereeereeEEeeEeereeEEeeeEereeEEEEeeEreeEEeeEeEREeeEeeeeeReeereeEeeeeEEreeEEEeeEereeEEEeEeEreeEEeeEeEreeEEeEEeeReeereeEeEeEEEreeereeEEEeeEereeEEeEEeereeEEeeEeereeeEeeeeEReeee

Outputs exactly Goodbye Cruel World!RERROR!.

And in the debug log: R # ERROR: R doesn't exist

Try it online!

Pepe, 199 195 bytes

Saved 4 bytes thanks to u_ndefined.

Because the absence of space after the ! annoys me.

reeEeeeEEErEeEEeEEEEreeereeereeEEeeEeereeEEeeeEereeEEEEeeEreeEEeeEeEREeeEeeeeeReeereeEeeeeEEreeEEEeeEereeEEEeEeEreeEEeeEeEreeEEeEEeeReeereeEeEeEEEreeereeEEEeeEereeEEeEEeereeEEeeEeereeeEeeeeEReeeReeee

Try it online!

Batch, 29 Bytes

echo Goodbye Cruel World!
|{

Explanation:

echo Goodbye Cruel World!         //Prints out (echoes) "Goodbye Cruel World!"
|{                                //I just typed random stuff here and hoped it would return an error.

R, 22 20! bytes (44/2) (40/2)

cat("Hello World!")
`Goodbye Cruel World!`

Try it online!

Output:

Hello World!

Error: object 'Goodbye Cruel World!' not found

Saved two points thanks to digEmAll

SOGL, 15 25 17 bytes / 2 = 8.5!

Q7┌θ/²?‘■←#c℮‘o0n

Explanation:

...‘           push "goodbye cruel world!"
    ...‘       push "hello world!"
         o     output "Hello World!"
           0n  attempt to make an array where each line is 0 characters long, making the array
               required to be infinite, which crashes (OutOfMemoryError)

(Ab)uses the fact that SOGL uses STDERR as a debug output, so in it there is a lot of text, along with the line

`∑`@22: ["goodbye cruel world!"]

If you piped the STDOUT of the Processing sketch to a file, the "Goodbye Cruel World!" would be there.

Rust, 66 bytes / 2 = 33

fn main(){println!("Hello World!");panic!("Goodbye Cruel World!")}

Try it online!

Prints "Hello World!" and makes the the program panic with message "Goodbye Cruel World!" The panic! macro doesnt need a semicolon because it returns () just like the main function.

Lua, 31, 30 bytes

a=-print'Goodbye Cruel World!'

first prints out 'Goodbye Cruel World!' and then crashes when trying to add a nil value and 0.

Output:

Goodbye Cruel World!
input:1: attempt to perform arithmetic on a nil value

Credit to GalladeGuy for 1 byte less

Common Lisp, 39 bytes

(format t"Goodbye, cruel world!~%")1/0

I have no real idea of LISP yet, but this should work even without a REPL but with direct eval, I have no way to proof it.

Clean, 64 bytes / 2 = 32 score

-2 thanks to Jo King

import StdEnv
Start=("Hello world!",abort"Goodbye cruel world!")

Try it online!

Prints Hello world!, tries to print the second element of the tuple and aborts with Goodbye cruel world!

Processing 3, 42 bytes

println("Goodbye Cruel World!");int b=1/0;

First try at using Processing for a golfing challenge. Couldn't figure out a way for the bonus challenge since Processing is very good at finding errors before you run your code!

Python 3, 33 bytes

print('goodbye cruel world!')

0/0

Forth (gforth), 26 bytes

." Goodbye Cruel World!" =

Try it online!

Prints output text and then crashes with a stack-underflow when it tries to call equals on an empty stack (assumes stack is empty before code is executed).


Forth (gforth), 28.5! bytes

." Hello World!" s" Goodbye Cruel World!" exception throw

Try it online!

The bonus is actually worse than the basic implementation even after the score modifier, due to the required use of exception and throw to get a custom error message in Forth.

Java 8, 108 bytes, score 54!

interface M{static void main(String[]a){System.out.print("Hello World!");new Byte("Goodbye Cruel World!");}}

Try it online here.

This solution attempts to create a Byte from the given String and crashes since "Goodbye Cruel World!" cannot be evaluated to an integer value.

Java 8, 93 bytes (no bonus)

interface M{static void main(String[]a){System.out.print("Goodbye Cruel World!");int i=0/0;}}

This is pretty straightforward as well. It crashes upon trying to divide by zero.

Try it online here.

Kotlin, 88 bytes/2=44 bytes!

fun main(a:Array<String>){print("Hello World!")
throw Exception("Goodbye Cruel World!")}

Try it online!

J, 28 Bytes

=:echo'Goodbye cruel world!'

Echoes 'Goodbye cruel world!', and then encounters a syntax error when theres no variable to assign the result (an empty list) to.

Example:

   =:echo'Goodbye cruel world!'
Goodbye cruel world!
|syntax error
|   =:echo'Goodbye cruel world!'

Yabasic, 21.5 bytes!

An anonymous function that takes no input, prints "Hello World!", then crashes with error "Goodbye Cruel World!"

?"Hello World!"
Error"Goodbye Cruel World!"

Try it online!

OCaml, 28.5! (57 Bytes / 2)

The OCaml version:

print_string"Hello World!";failwith"Goodbye Cruel World!"

The output is:

Hello World!Fatal error: exception Failure("Goodbye Cruel World!")

Windows .BAT, Score: 19.5!

echo Hello World!&"Goodbye Cruel World!

Yes it works on my CMD

Node.js, Score: 25.5 24.5!

Saved 1 point thanks to ETHproductions

A syntactically correct full program which crashes at runtime because console.log() is not returning a function.

console.log('Hello World!')`Goodbye Cruel World!`

Try it online!

Fortran (GFortran), 58/2=29 bytes!

PRINT*,'Hello World!'
ERRORSTOP 'Goodbye Cruel World!'
END

Try it online!

SmileBASIC, 44/2 = 22 bytes!

At first I thought there would be no way to get the bonus, since errors in SB only show a specific message along with the line number (ex: IF without THEN in 0:4) But then I remembered that MML (the language used for playing music) gives more detailed error messages, which display the code that caused the error!

?"Hello, World!
BGMPLAY"Goodbye Cruel World!

Output:

Hello, World!
Illegal MML in 0:2(BGMPLAY:1)
  Goodbye Cruel World!
    ^
 Missing number (in Track 0)

The error occurs because the o (set octave) command expects a number.

F#, score: 32!

[<EntryPoint>]printf"Hello World"
failwith"Goodbye Cruel World!"

Try it online!

T-SQL, 22 bytes

[Goodbye Cruel World!]

It tries to execute the nonexistent stored procedure called Goodbye Cruel World! -if there is no SQL Server instance with that dramatic sp-.

Swift - 50 bytes, 25 points after bonus

print("Hello World!\nGoodbye Cruel World!")
[0][1]

Haskell, 54 53 bytes, score 27! 26.5!

main=putStr"Hello World!">>fail"Goodbye Cruel World!"

Try it online! Outputs Hello World! and produces the following error message:

.code.tio: user error (Goodbye Cruel World!)

Edit: -1 byte/-0.5 score thanks to @nimi for suggesting fail.

C, 43 bytes

main(){puts(puts("Goodbye Cruel World!"));}

Prints the string and then tries to use the return value as a pointer to another string to be printed, which causes a segmentation fault.

Try it online!

C, 42 bytes

Thanks to @Ruslan!

main(i){i=puts("Goodbye Cruel World!")/0;}

Try it online!

Just for fun: C (on 64-bit Linux), 149 bytes

Modified from this Hello World -program here.

const int main[]={-443987883,440,113408,-1922629632,4149,1358336,84869120,15544,266023168,1869563654,1702453860,1970422560,1461742693,1684828783,33};

Try it online!

PHP, 24 bytes

<?d'Goodbye Cruel World!

Produces:

Parse error: syntax error, unexpected ''Goodbye Cruel World!' (T_ENCAPSED_AND_WHITESPACE) in [...][...] on line 1

JavaScript (ES6), 43 / 2 = 21.5 bytes!

alert`Hello World!`['Goodbye Cruel World!']

The same method as OrphanBot, but saves a few bytes with ES6 template strings.

Operation Flashpoint scripting language, 45/2 = 22.5 bytes

f={hint"Hello World!";a Goodbye Cruel World!}

Call with:

call f;

Output:

Alice, 44 40 bytes, score 22 20!

"!dlroW olleH"d&o`Goodbye Cruel World!é

Try it online!

-4 bytes by finding an interpreter bug.

Explanation

"!dlroW olleH"       push this string (one character at a time)
              d      stack depth
               &o    output that many bytes
                 `   print debug information

The Alice interpreter is written in Ruby, which can be strict about character encoding. When the debug command attempts to output the é (or any character in the range 0x80-0xFF) at the end of the program, this character is interpreted as ASCII-8BIT instead of UTF8, causing a crash.

Mode: Cardinal
Grid:
                 v
"!dlroW olleH"d&o`Goodbye Cruel World!Mode: Cardinal
Grid:
                 v
"!dlroW olleH"d&o`Goodbye Cruel World!/opt/alice/state.rb:234:in `write': "\xE9" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
    from /opt/alice/state.rb:234:in `<<'
    from /opt/alice/state.rb:234:in `block (2 levels) in print_grid'
    from /opt/alice/state.rb:234:in `each'
    from /opt/alice/state.rb:234:in `block in print_grid'
    from /opt/alice/state.rb:233:in `each'
    from /opt/alice/state.rb:233:in `each_with_index'
    from /opt/alice/state.rb:233:in `print_grid'
    from /opt/alice/state.rb:221:in `print_debug_info'
    from /opt/alice/interpreter.rb:16:in `rescue in <main>'
    from /opt/alice/interpreter.rb:13:in `<main>'

Batch, 20.5 bytes!

@echo Hello World!
"Goodbye Cruel World!

C, 42 bytes

Not shorter than Steadybox's C answer, but more resistant to optimization.

main(){ftw(puts("Goodbye Cruel World!"));}

ftw has a short name and its first parameter is a pointer, so the return value from puts makes it crash.

Kotlin, 89/2= 44.5 bytes!

Pretty much the same as the java answer

fun main(args:Array<String>){
println("Hello world")
throw Error("Goodbye cruel world!")}

Try it online!

Output:

Hello world

Exception in thread "main" java.lang.Error: Goodbye cruel world!
    at Simplest_versionKt.main(Simplest version.kt:8)

JavaScript 58 bytes , with bonus 58/2 = 29 bytes

console.log("Hello World!");
throw "Goodbye Cruel World!"

Very Straightforward , I have crashed the program with the "Good Bye Cruel World!" error.

EDIT : Thanks to eithed and Erik the OutGolfer , Saved 36 bytes !. Hope this method still works for the challenge

Mathematica, 23! Bytes

Print["Hello World!"]/."Goodbye Cruel World!";

Prints the first string then attempts to use the second string as a replacement rule which it isn't so crashes (throws an error message which is equivalent to a crash in Mathematica).

Output:

Hello World

ReplaceAll::reps: {Goodbye Cruel World!} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

PowerShell, 26 Bytes

'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.

PowerShell, 35/2 = 17.5 Bytes

"Hello World!";Goodbye Cruel World!

by TessellatingHeckler, throws the error like so:

PS C:\Users\Connor> "Hello World!";Goodbye Cruel World!
Hello World!
Goodbye : The term 'Goodbye' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:16
+ "Hello World!";Goodbye Cruel World!

Rexx (Regina), 39/2 37/2 bytes = 19.5!

say Hello World!
-Goodbye Cruel World!

Try it online!

SmileBASIC 3, 28 bytes

Tries to call a function named the empty string, which of course doesn't exist.

There's probably a better way to make a SB program crash, but this way is only 5 characters, so I'm not complaining.

?"Goodbye Cruel World!
CALL"

C, 60 bytes

puts("Hello, World!");puts("Goodbye, cruel world!");abort();

Java 6, 83 bytes, Score 41.5!

Java 6 loaded static initializers before searching for the main method, making it possible to bypass the lengthy main signature. However, past 6, it first looks for the main method and then static initializers, making this solution void.

class A{static{System.out.print("Hello World!");new Long("Goodbye Cruel World!");}}

Expanded:

class A {
    static {
        System.out.print("Hello World!");
        new Long("Goodbye Cruel World!");
    }
}

Bash 20.5! 18.5!

I am not going to bash jelly, but I am a little bashful of my bash at bashing out a quick bash script. 18.5 isn't too bad for a non-golfing language. (Note this has to be a script, interactive bash will try to interpret ! as a history lookup)

echo Hello World!
Goodbye\ Cruel\ $_

Returns with error code 127 and:

Hello World!
bash.sh: line 2: Goodbye Cruel World!: command not found

As requested no "'s... anywhere :). As suggested by apricot boy I now lookup the last argument of the previous command to save 4 bytes.

Pyth -- 38/2 = 19 !

K" World!"p"Hello"Kp"Goodbye Cruel"KsG

Try It

JS (ES5), 46 / 2 = 23 bytes!

alert("Hello, World!")["Goodbye Cruel World!"]

Alerts Hello, World!, then errors with Uncaught TypeError: Cannot read property 'Goodbye Cruel World!' of undefined

Pyth, 38 / 2 = 19 bytes! 36 / 2 = 18 bytes!

"Hello World!"v"Goodbye Cruel World!

Test it online!

Explanations

It prints Hello World!, then try to evaluate Goodbye Cruel World!. It fails doing it, because that string is not a valid code.

The result is:

Hello World!
Traceback (most recent call last):
  File "pyth.py", line 760, in <module>
  File "<string>", line 4, in <module>
  File "/app/macros.py", line 1085, in Pliteral_eval
  File "/app/.heroku/python/lib/python3.4/ast.py", line 46, in literal_eval
  File "/app/.heroku/python/lib/python3.4/ast.py", line 35, in parse
  File "<unknown>", line 1
    Goodbye Cruel World!
                ^
SyntaxError: invalid syntax

APL (Dyalog), 17.5 bytes

Without bonus, 20 bytes

Goodbye Cruel World!

Try it online!

Note that the code is unquoted, so APL tries to execute it but World is not defined, causing a VALUE ERROR crash with the offending line of code included in the error message.

With bonus, 35 ÷ 2 = 17.5 bytes

'Hello World!'
Goodbye Cruel World!

Try it online!

First prints the required string, then crashes like the above program.

More sofisticated bonus version, 35 ÷ 2 = 17.5 bytes

⍎'Goodbye Cruel',5↓⎕←'Hello World!'

Try it online!

Prints the first string, then drops the first five characters from that (5↓), then concatenates that (,) to a new prefix, and then attempts to execute () that, causing the same error as above.

LOLCODE, I CAN HAZ 21 BYTES

:Goodbye Cruel World!

Simply places an invalid operator in front of the string. You can give it a go online here.

C++, 66 bytes

Compiles with VS 2017. A little type confusion for the crash.

extern"C"{int puts(void*);int main=puts("Goodbye Cruel World!");}

Micro, 24 20.5

"Hello, World!":\"Goodbye, cruel world"0/

Previous version, no bonus:

""Goodbye, cruel world"0/

Lua, 47 / 2 == 23 bytes

Prints "Hello World!" to STDOUT, then crashes with "Goodbye cruel world!" and a stack trace to SDTERR.

print"Hello World!"
error"Goodbye cruel world!"

Julia, 30 bytes

!print("Goodbye Cruel World!")

Eagerly prints "Goodbye Cruel World!", then tries to NOT the return value and crashes because performing a NOT on a void value is not defined.

x86-64 Binary Code (with Linux system calls), 43 bytes

Disassembly:

0:  31 c0                   xor    eax,eax
2:  ff c0                   inc    eax            ; write syscall number = 1
4:  31 ff                   xor    edi,edi
6:  ff c7                   inc    edi            ; stdout file descriptor = 1
8:  48 8d 35 07 00 00 00    lea    rsi,[rip+0x7]  ; load the string at offset 16 into rsi
f:  31 d2                   xor    edx,edx
11: b2 15                   mov    dl,0x15        ; 21 byte string
13: 0f 05                   syscall
15: f4                      hlt
16: 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 0a .ascii "Goodbye Cruel World!\n"

Note: 0x16 code bytes + 0x15 string bytes = 0x2B = 43 total bytes

This program bundles the data it needs (the string "Goodbye Cruel World!\n") into its own code. It loads a pointer to that string using rip relative addressing, and calls the write syscall directly rather than through a glibc wrapper, so it's entirely position-independent, and we can easily test it by embedding the code into a const string and casting that string to a function pointer. To crash the program, I end it with a hlt instruction, which with ring 0 privileges would silence the processor forever (or at least until the next interrupt comes in), but with ring 3 privileges (typical for user programs) we get a far less dramatic Segmentation Fault.

Test Program:

#include <stdio.h>

const char code[43] = "\x31\xC0\xFF\xC0\x31\xFF\xFF\xC7\x48\x8D\x35\x07\x00\x00\x00\x31\xD2\xB2\x15\x0F\x05\xF4Goodbye Cruel World!\n";

int main() {
    printf("Code bytes: %zi\nNow running the code:\n\n", sizeof(code));
    ((void(*)())code)();
    printf("Failed to crash, now exiting!\n");
    return 0;
}

Output:

Code bytes: 43
Now running the code:

Goodbye Cruel World!
Segmentation fault

Note that the 43 byte code is a complete program as specified by the challenge, not just a function. It doesn't depend on the main function of the test program to function correctly; it would still print the string and crash if loaded and jumped-to by the loader directly.

C Preprocessor, 27 bytes

#error Goodbye Cruel World!

Output:

fatal error C1189: #error:  Goodbye Cruel World!

WinDBG (Windows XP/Vista Local Kernel Debugging), 33 bytes

.echo Goodbye Cruel World!;.crash

Warning: This will crash the entire machine, not just the program.

Local kernel debugging is only allowed on Windows XP and Vista (but not enabled by default in Vista). The WinDBG dialog on local kernel debugging does't mention any other Windows OS so I assume it can't even be enabled for those. Presumably for other Windows OS's you can attach to a remote machine for kernel debugging, but it's the remote machine that will crash so I don't think this solution counts there.

Ruby, 43 42 bytes/2 = 21!

puts"Hello World!"
-"Goodbye cruel World!"

Saved half a byte with the help of Alexis Andersen, by replacing "String"/0 with -"String". This only "works" with Ruby versions lower than 2.3, in which the unary minus method was actually added to the String class!

With Ruby < 2.3:

$ ruby -e 'puts"Hello World!";-"Goodbye cruel World!"'
Hello World!
-e:1:in `<main>': undefined method `-@' for "Goodbye cruel World!":String (NoMethodError)

With Ruby >= 2.3:

$ ruby -e 'puts"Hello World!";"Goodbye cruel World!"/0'
hello world!
-e:1:in `<main>': undefined method `/' for "Goodbye cruel World!":String (NoMethodError)

Jelly, 10.5! bytes

“,ḷṅḳȦ»¹“¿µƝɓṭỵae»+/R

Try it online!

This exploits undefined behavior, using Python strings (strings) instead of Jelly strings (list of 1-char strings). The conversion is done by reducing the Jelly string by addition, and Python's + concatenates two strings, so two strings added together are concatenated Python-wise. Then, it uses the appropriate monad (range) so that Python's int is called on the string, resulting in an error that would always contain Goodbye Cruel World!.

Explanation:

“,ḷṅḳȦ»¹“¿µƝɓṭỵae»+/R Main Link, niladic.
“,ḷṅḳȦ»¹              Print "Hello World!"
        “¿µƝɓṭỵae»+/  Convert "Goodbye Cruel World!" to a Python string
                    R Make a range out of it

Kitanai (28 bytes)

print"Goodbye Cruel World!"z

It just prints "Goodbye Cruel World!" then tries to call unknown function z (so it crashes)

APL, 28

÷~×⍴⎕←'Goodbye Cruel World!'

This first displays the text, then tries to take the reciprocal ÷ of the not ~ of the sign × (an integer 1) of the length ⍴ of the text. As the sign of the length will always be 1, the not of which is 0, the reciprocal will produce a DOMAIN ERROR.

In all fairness, ngn\apl does not crash, rather will output infinity. Nearly all other (legacy) APLs such as Dyalog, APL2000, and IBM APL2, do not handle NaNs or +/-Inf and will crash as expected.

C#, 116 / 2 = 58 bytes!

using System;class P{static void Main(){Console.Write("Hello World!");throw new Exception("Goodbye Cruel World!");}}

Normal version for 94 87 bytes:

class P{static void Main(){System.Console.Write("Goodbye Cruel World!");int n=0;n/=n;}}

Saved 7 bytes thanks to @KevinCruijssen.

Japt, 22 bytes

°Oo`!dlžW ¤¨C eybºoG`w
°Oo`!dl&#158;W ¤¨C eybºoG`w
 Oo                            output
   `!dl&#158;W ¤¨C eybºoG`     the compressed string "!dlroW leurC eybdooG"
                          w    reversed.
°                              ° transpiles to ++, causing an error; a string can't be incremented

Try it online!

Saved 3 bytes thanks to obarakon and ETHproductions

Ruby, 38 bytes, score 19!

p"Hello World";"Goodbye cruel World".q

Run with ruby -e

sed, 32 bytes

iGoodbye Cruel World!
w/dev/full

i inserts a line, and w writes to a file. /dev/full in this case because all writes to it return ENOSPC ("No space left on device").

It still needs a single line of input to work, though.

$ echo 1 | sed -f crash.sed
Goodbye, cruel world!
sed: couldn't flush /dev/full: No space left on device

TeX, 19!

Hello World!#\bye Goodbye Cruel World!

To force TeX to actually produce a dvi/pdf file without manual intervention, compile with -interaction=nonstopmode.

It prints Hello World!, throws an error for using # when you're not supposed to and then stops compilation with \bye. However, whatever's after \bye is still output in the error message, so it applies for the bonus.

Go, 76 bytes, score 38!

package main
func main(){print("Hello World!");panic("Goodbye Cruel World!")}

(Edit: switch strings around).

Formatted:

package main

func main() {
        print("Hello World!")
        panic("Goodbye Cruel World!")
}

No semicolon in formatted version because of the line breaks.

https://play.golang.org/p/DM48LwZ_0T

Might be able to reduce this with a wizardry int-->string hack, but whatever.

TI-BASIC, 24 bytes (which happens to be 4!)

:Disp "GOODBYE CRUEL WORLD!
:{

Displays the string, then partially defines a list, causing a syntax error.

Jelly, 12 bytes

“¿µƝɓṭỵae»Ȯ:

Try it online!

Explanation:

“¿µƝɓṭỵae»Ȯ:

          Ȯ     Print
“¿µƝɓṭỵae       A string...
         »      Decoded from base-250
           :    Integer division

As the integer division is a dyad, it will implicitly take the chain's current value as both arguments - which is a string. Crashes because it expects integers.

Perl 5, 43/2 = 21.5 bytes!

say'Hello World!';die'Goodbye Cruel World!'

Pretty straightforward. die just crashes the program with the given error message plus some extra fluff.

Python 3 | Score: 24.5! 23 22!

print("Hello World!")+"Goodbye Cruel World!"

Print "Hello World", than use invalid operator '+' on "Goodbye Cruel World!" to the NoneType return element. (cut out \n\r from previous version)

Try it online!

Python 3 | Score: 34 30

+print("Goodbye Cruel World!")

Print Goodbye, than do an invalid unary + operation on print result (NoneType)

Try it online!

Pyth, 28 24 bytes

"GOODBYE CRUEL WORLD!"hY

Prints a string, then tries to get the first element of the empty list.

Try this!

CJam, 34 bytes, score 17!

"Goodbye Cruel World!"D>"Hello"ooo

Try it online! (See Debug panel for STDERR)

Explanation

"Goodbye Cruel World!"              e# Push "Goodbye Cruel World!".
                      D>            e# Slice after index 13: " World!".
                        "Hello"o    e# Push "Hello" and print it.
                                o   e# Print " World!".
                                 o  e# Attempt to print from an empty stack. Crashes.

On TIO, it generates this error message:

"Goodbye Cruel World!"D>"Hello"ooo
                                 ^
RuntimeException: The stack is empty
Java exception:
java.lang.RuntimeException: The stack is empty
    at net.aditsu.cjam.CJam.pop(CJam.java:75)
    at net.aditsu.cjam.Op1.run(Op1.java:10)
    at net.aditsu.cjam.Block.run(Block.java:304)
    at net.aditsu.cjam.CJam.runCode(CJam.java:210)
    at net.aditsu.cjam.CJam.main(CJam.java:240)

AWK, 72 bytes, Score 36!

BEGIN{print"Hello World!";print"Goodbye Cruel World!">"/dev/stderr";0/0}

Try it online!

AWK isn't fond of trying to divide by 0.

Arcplus, 25 bytes

(p "Goodbye Cruel World!"

Aceto, score: 21.5!

yeru
b Ce+
do l"d
GoWorl
"!dl
p"or
HeW
"llo

Prints Hello World!, then crashes with

Traceback (most recent call last):
  File "/Users/l3viathan/bin/aceto", line 230, in _plus
    self.push(y+x)
TypeError: unsupported operand type(s) for +: 'int' and 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/l3viathan/bin/aceto", line 811, in <module>
    A.run()
  File "/Users/l3viathan/bin/aceto", line 104, in run
    raise e
  File "/Users/l3viathan/bin/aceto", line 98, in run
    self.step()
  File "/Users/l3viathan/bin/aceto", line 152, in step
    method(self, cmd)
  File "/Users/l3viathan/bin/aceto", line 233, in _plus
    raise CodeException(f"Can't add {x!r} to {y!r}")
__main__.CodeException: Can't add 'Goodbye Cruel World' to 0

><>, 25 bytes

"!dlroW leurC eybdooG">o<

Basically it adds the string to the stack (Backwards, last in first out) and then does the equivalent of:

while(1):
  pop the stack
  print the character

When there are no characters left on the stack (The whole string has been printed) popping the stack gives an error

PHP, 26

Goodbye Cruel World!<?=!a;

Octave, 28 bytes

disp"Goodbye Cruel World!"
d

Try it online!

This displays "Goodbye Cruel World!" in the shortest possible way in Octave (by skipping the parentheses and avoiding a space).

The d on the next line is an undefinied variable, so it errors with the message:

error: 'd' undefined near line 2 column 1
error: called from
    .code.tio at line 2 column 1

If it's OK to output: ans = Goodbye Cruel World! then it can be 24 bytes.