# Goodbye Cruel World!

## Background

Hello golfers! I would like to learn all the programming languages! But I kinda have a short attention span... and copying all the Hello World examples gets boring... but I like fire! ^w^

## Challenge

So here is the plan! I want you all to write the smallest code that will compile, print Goodbye Cruel World!, and then crash. Or, as a bonus twist challenge, print Hello World! and crash with Goodbye Cruel World!

## Rules

• Your score will be total character count used. The answer must be a whole executable program.
• Your program must print Goodbye Cruel World! to output, and then crash (unexpected error).
• For a score bonus, you must print Hello World! to output instead, but the error message must also contain Goodbye Cruel World!. If you complete the bonus challenge, you may divide your score by 2. (Include a ! at the end of your score if you are claiming the bonus!)
• As long as the standard output still prints, and standard error still prints, the order doesn't matter. Just as long as neither can block the other from happening.
• The output must contain the contents of the above; " shouldn't appear in the output.
• The output should contain the specified string, and nothing else.
• The crash report can contain anything, but to claim the bonus, the following regex should match /Goodbye Cruel World!/mi (aka, contains, ignore case/surrounding text))
• The strings Hello World! and Goodbye Cruel World! are case insensitive, but otherwise should appear exactly as above.
• If the language is capable of crashing (it cannot change its exit code), it needs to crash. Otherwise use the standard "error report" (i.e., STDERR) for the language.

I can crash Python 3, so I have included an example Python 3 answer! Now lets all set the world on fire! ^W^

var QUESTION_ID=125282,OVERRIDE_USER=0;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+r.match(SCORE_REG)[0],language:r.match(LANG_REG)[0].replace(/<\/?[^>]*>/g,"").trim(),link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/\d+((?=!?)|(?= Bytes))/i,OVERRIDE_REG=/^Override\s*header:\s*/i;LANG_REG=/^[^,(\n\r\|]+/i body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px} <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=617d0685f6f3"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> • Comments are not for extended discussion; this conversation has been moved to chat. – Dennis Jun 8 '17 at 13:41 • as a bonus twist challenge, print "Hello World!" and crash with "Goodbye Cruel World!"? – Magic Octopus Urn Jun 8 '17 at 14:34 • Suppose I'm working in a language like Java, where STDOUT and STDERR are, of course, printed in different threads. This means that, although the program, in order, prints "Hello world" and then crashes, it is possible that the stack trace will be printed first... Is that allowed? – Socratic Phoenix Jun 8 '17 at 14:39 • @SocraticPhoenix As long as STDOUT still prints, and STDERR still prints, the order doesn't matter. Just as long as neither can block the other from happening. – Tezra Jun 8 '17 at 14:45 • This is so much fun, I can't stop making solutions! – Adám Jun 9 '17 at 12:31 ## 102 Answers # 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!  # Jstx, 22 bytes / 2 = score 11! ₧P4☼♫╗ååÿΔ{îª2╡¬ûÿ~í£▬  Try it online! # 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. # 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


# 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.

# 05AB1E (legacy), score: 13.513 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:

• The ,, which is an explicit print with trailing newline
• And F instead of .ǝ, which is a ranged loop and will error because the "goodbye cruel world!" is not an integer:

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

• } exits in an error (non-legacy). Try it online! Also, for legacy .0 causes division by 0 error forcibly. – Magic Octopus Urn Oct 24 '18 at 17:47
• @MagicOctopusUrn Ah, completely forgot about .0, since the commands had already changed when I posted this and it's not in the new version anymore. As for the errors in the Elixir rewrite, it can crash with quite a few different ways now, but mostly due to a bug that wasn't in the legacy version yet, so usually I report it in the 05AB1E chat to Adnan. – Kevin Cruijssen Oct 24 '18 at 20:44
• .•Uqʒ•’‚¿Þ¡ ÿ ‚ï!’ -> “‚¿bye±ƒuel‚ï“ for -4. There's no .ǝ in modern 05AB1E, but here's an equal-bytes alternative. – Grimmy Sep 3 '19 at 13:41
• @Grimy Thanks. Didn't knew cr was a dictionary word. – Kevin Cruijssen Sep 4 '19 at 6:43
• @Grimy Woops, should have been 23 instead of 22.. Your versions were missing the exclamation mark in the goodbye cruel world!. I've updated the 11 to 11.5 when I noticed that, but forgot to update the 22. – Kevin Cruijssen Sep 4 '19 at 9:27

# 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?

# 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


# 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.


# 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.

(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.


# 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!

"!dlroW leurC eybdooG"W/
`