49
\$\begingroup\$

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>

\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – Dennis Jun 8 '17 at 13:41
  • \$\begingroup\$ as a bonus twist challenge, print "Hello World!" and crash with "Goodbye Cruel World!"? \$\endgroup\$ – Magic Octopus Urn Jun 8 '17 at 14:34
  • \$\begingroup\$ 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? \$\endgroup\$ – Socratic Phoenix Jun 8 '17 at 14:39
  • \$\begingroup\$ @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. \$\endgroup\$ – Tezra Jun 8 '17 at 14:45
  • 1
    \$\begingroup\$ This is so much fun, I can't stop making solutions! \$\endgroup\$ – Adám Jun 9 '17 at 12:31

95 Answers 95

3
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ fail instead of error. \$\endgroup\$ – nimi Jun 8 '17 at 20:53
  • \$\begingroup\$ @nimi Thanks! I didn't know about fail before. \$\endgroup\$ – Laikoni Jun 15 '17 at 15:59
3
\$\begingroup\$

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!")
\$\endgroup\$
  • 1
    \$\begingroup\$ Welcome to the site! :) \$\endgroup\$ – DJMcMayhem Mar 24 '18 at 13:20
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Hi and welcome to PPCG! Just a small correction: the panic! macro returns the never type (!), which can be used as any type (including ()) example playground \$\endgroup\$ – Herman L Aug 21 '18 at 16:27
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Since a 64 bit number can represent 8 chars, I wonder if it is possible to construct the string using some clever arithmetic and shifting. Specifically 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21. \$\endgroup\$ – qwr Apr 1 '18 at 2:57
  • \$\begingroup\$ 64 bit multiply fills up rdx:rax \$\endgroup\$ – qwr Apr 1 '18 at 3:22
3
\$\begingroup\$

x86-16 Assembly, IBM 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 actually crash DOS to the point that a hard reset (power cycle) of your PC will most likely be required.

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

PHP, 26

Goodbye Cruel World!<?=!a;
\$\endgroup\$
  • 1
    \$\begingroup\$ This doesn't crash. In fact, this only throws a warning which usually are disregarded. Basically, your code is just Goodbye Cruel World! which is incorrect. If you want to crash, do <?x();, which will throw an exception in PHP 7+. \$\endgroup\$ – Ismael Miguel Jun 8 '17 at 21:41
2
\$\begingroup\$

Arcplus, 25 bytes

(p "Goodbye Cruel World!"
\$\endgroup\$
  • \$\begingroup\$ The stderr output doesn't contain Goodbye Cruel World as required for the bonus multiplier. \$\endgroup\$ – L3viathan Jun 8 '17 at 15:14
  • \$\begingroup\$ @L3viathan the spec doesn't specify STDERR: but the debug must also contain \$\endgroup\$ – Skidsdev Jun 8 '17 at 15:17
  • \$\begingroup\$ @L3viathan it doesn't output the exact string though, due to the spaces vs underscores, so I'll change it anyway \$\endgroup\$ – Skidsdev Jun 8 '17 at 15:18
  • \$\begingroup\$ Yeah, that's what I meant, I didn't complain that it wasn't stderr. \$\endgroup\$ – L3viathan Jun 8 '17 at 15:25
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Can't remember the exact rule but this program doesn't run without the -E flag, so you need to add at least one byte. \$\endgroup\$ – pipe Jun 10 '17 at 13:27
  • \$\begingroup\$ @pipe The -E flag is allowed on this site without a penalty, since it's arguably the "normal" way of writing a perl one-liner. \$\endgroup\$ – Chris Jun 10 '17 at 21:24
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ If you replaced the "{" with a "(", you could have a frowny emoticon as the last line. Would that have the same effect? \$\endgroup\$ – eaglgenes101 Oct 30 '17 at 22:31
  • \$\begingroup\$ @eaglgenes101 No. ( does not define a list, it just groups expressions. \$\endgroup\$ – Scott Milner Oct 30 '17 at 22:49
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Switch the strings around. "Hello World" should be in STDOUT, and "Goodbye Cruel World!" should be in the error message. (for the bonus challange) \$\endgroup\$ – Tezra Jun 8 '17 at 20:54
  • \$\begingroup\$ Go's print() prints to STDERR, not STDOUT. You have to use fmt for printing to STDOUT. \$\endgroup\$ – totallyhuman Jun 10 '17 at 20:40
  • \$\begingroup\$ @totallyhuman Is that not a compile/runtime configuration? The Go spec only defines it as "prints all arguments; formatting of arguments is implementation-specific" so the Go code itself is correct, no? \$\endgroup\$ – AniSkywalker Jun 11 '17 at 21:03
2
\$\begingroup\$

Ruby, 38 bytes, score 19!

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

Run with ruby -e

\$\endgroup\$
  • 1
    \$\begingroup\$ The output should contain the specified string, and nothing else. -- This prints extra quotes around the string. \$\endgroup\$ – daniero Jun 11 '17 at 2:50
2
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

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"
\$\endgroup\$
  • \$\begingroup\$ Using a weird bug: ?"Goodbye Cruel World!";? \$\endgroup\$ – 12Me21 Mar 3 '18 at 16:14
2
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ You don't need to assign the message - console.log("Hello World!");throw new Error("Goodbye Cruel World!") will suffice (or even console.log("Hello World!");throw "Goodbye Cruel World!", though the rules are kind of weird for JS on this one) \$\endgroup\$ – eithed Jun 9 '17 at 14:51
  • \$\begingroup\$ You can remove superfluous whitespace around the =s and newlines after ;s. \$\endgroup\$ – Erik the Outgolfer Jun 11 '17 at 11:14
2
\$\begingroup\$

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)
\$\endgroup\$
2
\$\begingroup\$

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>'
\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ Hello and welcome to the site. It is customary to put separate languages in separate answers. The site may prompt you not to but thats SE's policy not ours. \$\endgroup\$ – Wheat Wizard Jun 15 '17 at 1:27
2
\$\begingroup\$

Swift - 50 bytes, 25 points after bonus

print("Hello World!\nGoodbye Cruel World!")
[0][1]
\$\endgroup\$
2
\$\begingroup\$

F#, score: 32!

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

Try it online!

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

Kotlin, 88 bytes/2=44 bytes!

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

Try it online!

\$\endgroup\$
  • \$\begingroup\$ Using @EndermanAPM Error instead of Exception would yield 84/2 or 42. \$\endgroup\$ – JohnWells Apr 1 '18 at 2:05
2
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ Quick note: jump to 0, aside from causing errors, is an incredibly unexpected behavior - what it does is fail spectacularly. Afaik most emulators for mips will just error and call it a day, though i can't vouch for all of them. If this behavior is too much of a "watch the world burn" i can tone it down to whatever is desired, i guess \$\endgroup\$ – Andrew Baumher Aug 21 at 3:00
  • \$\begingroup\$ extra credit for crashing the system, not just a program :) \$\endgroup\$ – roblogic Aug 21 at 3:51
1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ You can just remove ~×⍴ since the reciprocal of a string gives a DOMAIN ERROR on all APL systems. \$\endgroup\$ – Adám Jun 9 '17 at 12:11
1
\$\begingroup\$

Kitanai (28 bytes)

print"Goodbye Cruel World!"z

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

\$\endgroup\$
1
\$\begingroup\$

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!"
\$\endgroup\$
1
\$\begingroup\$

Micro, 24 20.5

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

Previous version, no bonus:

""Goodbye, cruel world"0/
\$\endgroup\$
1
\$\begingroup\$

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!");}
\$\endgroup\$
1
\$\begingroup\$

Pyth -- 38/2 = 19 !

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

Try It

\$\endgroup\$
1
\$\begingroup\$

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!");
    }
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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