479
\$\begingroup\$

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with , and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of Wikipedia (the Wikipedia entry has been deleted but there is a copy at archive.org ), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

  • Each submission must be a full program.
  • The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.
  • The program must not write anything to STDERR.
  • If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

    Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

  • Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.
  • This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".
  • If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:

## [><>](https://esolangs.org/wiki/Fish), 121 bytes

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();
    
    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

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="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">
<div id="language-list">
  <h2>Shortest Solution 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>
<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>
<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\$
21
  • 3
    \$\begingroup\$ @isaacg No it doesn't. I think there would be some interesting languages where it's not obvious whether primality testing is possible. \$\endgroup\$ Aug 28 '15 at 13:56
  • 6
    \$\begingroup\$ If the same program, such as "Hello, World!", is the shortest in many different and unrelated languages, should it be posted separately? \$\endgroup\$ Aug 28 '15 at 15:33
  • 2
    \$\begingroup\$ @mbomb007 Well it's hidden by default because the three code blocks take up a lot of space. I could minify them so that they are a single line each, but I'd rather keep the code maintainable in case bugs come up. \$\endgroup\$ Aug 28 '15 at 19:34
  • 8
    \$\begingroup\$ @ETHproductions "Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge." Publishing the language and an implementation before posting it would definitely be helpful though. \$\endgroup\$ Aug 29 '15 at 23:01
  • 2
    \$\begingroup\$ @MartinEnder ... Almost. If two BF solutions have the same size, the one with smaller lexicographical order will take smaller number of bytes in Unary. Of course the smallest Unary solution translated to BF is guaranteed to be smallest. \$\endgroup\$
    – DELETE_ME
    May 20 '18 at 10:20

868 Answers 868

1 2
3
4 5
29
15
\$\begingroup\$

Wierd, 1341 bytes

Unlike other languages where the symbols in a program determine which instructions are executed, in Wierd, it is the bends in the chain of arbitrary symbols that determine which instructions are executed.

From the website:

First, a Riddle:
Q: What do you get when you put three marginally-sane programmers on a mailing list with the Befunge and BrainF*** programming languages?
A: You get BeF***, and then they get Wierd.
...
Chris Pressey then jumped on it, created the angle-to-instruction mapping, and christened the entire mess "Wierd"--a cross between the words "weird" (which the language seemed to be) and "wired" (which would describe the appearance of programs written in the language).

Try it online at http://catseye.tc/installation/Wierd_(John_Colagioia)

EDIT: Dennis has killed this answer quite thoroughly with this

Even though this is much smaller than the sameple that comes with the interpreter I am positive this can be golfed more (and it has been - by Dennis) Please try to come up with something smaller and edit the question with that version.

,!dlroW             ++
o     #           ++  +
l               ++    + ++++
l     +++     ++      ++  +
e    +   +  ++    ++  +  +
H   +  +  ++    ++  +   +
+  +  ++      ++     +++
+ ++++ +    ++
+      +  ++           ++
+  +++++++   +++     ++  +
 ++    +    +   +  ++    + ++++
       +   +  +  ++      ++  +
       +  +  ++      ++  +  +
       + ++++ +    ++  +   +
       +      +  ++     +++
       +  +++++++
        ++    +   +++
    +         +  +   +  ++
    ++       +  +  +  ++  +
    + +     +  +  ++      + ++++
    +  +    + ++++ +      ++  +
     +  +   +      +  ++  +  +
      +  +  +  +++++++  +   +
    ++++  +  ++    +     +++
    +      +       +
     +      +++++++      +++
      +                ++   +
       +             ++     +
       +           ++      +
++++++++++++     ++   ++  ++++
 +     +    +  ++   ++  +     +
  ++++ +     ++   ++     +++++++
    +  +        ++
   +   +      ++
  +    +    ++
 +     +  ++
+       ++        +++
+               ++   +
+ +++++++     ++     +
+  +     +  ++      +
+   ++++  ++   ++  ++++
+     +      ++  +     +
+    +     ++     +++++++
+    +   ++
+  ++++++   +++++++     +++
 ++  +       +     +  ++   +
     +        ++++  ++     +
     +          +         +
     +      ++++     ++  ++++
     +             ++  +     +
     +  +++++++++++     +++++++
      ++
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Nice job! I was hoping someone would beat the official HW example eventually. :) \$\endgroup\$ Jan 12 '16 at 9:15
  • \$\begingroup\$ I wonder if they misspelled "weird" intentionally... \$\endgroup\$
    – mbomb007
    Feb 24 '16 at 19:58
  • 1
    \$\begingroup\$ @mbomb007 Yes. The web page catseye.tc/view/wierd/dialect/wierd-jnc/doc/wierdspec.txt says that Chris Pressey then jumped on it, created the angle-to-instruction mapping, and christened the entire mess "Wierd"--a cross between the words "weird" (which the language seemed to be) and "wired" (which would describe the appearance of programs written in the language) \$\endgroup\$ Feb 24 '16 at 20:12
14
\$\begingroup\$

Fortran, 28 bytes

print'("Hello, World!")'
end

You can't write print*,"Hello, World!" because there's a leading space in the default print format. Thus, we pass in our own format that simply contains a constant string.

\$\endgroup\$
4
  • \$\begingroup\$ Which version of Fortran is this? In F77 you'd need some spacing if I'm not mistaken. \$\endgroup\$ Jul 19 '16 at 12:37
  • \$\begingroup\$ @RobertBenson F77 would also require fixed form if I'm not mistaken. In any case, this works in GFortran. tio.run/##S8svKilKzNNNT4Mw/v8vKMrMK1HXUPJIzcnJ11EIzy/… \$\endgroup\$
    – Dennis
    Jun 6 '17 at 6:24
  • \$\begingroup\$ Yes, F77 is fixed format, so you'd need some tabs, which adds to byte-count :( \$\endgroup\$ Jun 7 '17 at 15:10
  • 1
    \$\begingroup\$ GFortran: print*,"Hello, World!";end 26 bytes, but it prefixes a space char :( \$\endgroup\$
    – roblogic
    Aug 27 '19 at 9:55
13
\$\begingroup\$

BBC BASIC, 20 bytes

PRINT"Hello, World!"

Ahh, this was my first language :)

\$\endgroup\$
6
  • \$\begingroup\$ so BBC Basic does not accept ? as a shorhand for print? \$\endgroup\$
    – edc65
    Aug 28 '15 at 14:27
  • \$\begingroup\$ @edc65 I have no idea... I'll try \$\endgroup\$
    – Beta Decay
    Aug 28 '15 at 14:28
  • \$\begingroup\$ @edc65 It doesn't work in BBC BASIC for Windows \$\endgroup\$
    – Beta Decay
    Aug 28 '15 at 14:53
  • \$\begingroup\$ Strange, as it's quite standard in basic. A posted an answer as VBA \$\endgroup\$
    – edc65
    Aug 28 '15 at 14:59
  • 1
    \$\begingroup\$ @edc65, The "?" is NOT accepted, seems it conflicts with BBC Basic's PEEK() variant. But this is: P."Hello, World!" \$\endgroup\$ Mar 19 '17 at 8:31
13
\$\begingroup\$

Packed 7-bit ASCII, 12

fÍëWßËfD 

Since Markdown eats some of the characters, here's a hexdump:

$ xxd hello.ascii 
0000000: 9197 66cd eb10 57df cb66 4420            ..f...W..fD 

And yes, the trailing space is necessary.

Packed 7-bit ASCII is created by taking 8-bit ASCII (the normal kind), removing the high zero bit from each byte, packing the remainder, and then padding it out with trailing zero bits.

According to this site, this character encoding is used by "a specific US MIL STD message header format", making it a real thing.

\$\endgroup\$
3
  • 3
    \$\begingroup\$ Is Packed ASCII a programming language on its own right? \$\endgroup\$ Aug 30 '15 at 16:04
  • \$\begingroup\$ @user3819867 It's an edge case. It depends on definitions. \$\endgroup\$
    – isaacg
    Aug 30 '15 at 16:19
  • \$\begingroup\$ Packed 7-bit ASCII is the encoding SMS uses \$\endgroup\$
    – slebetman
    Sep 1 '15 at 4:31
13
\$\begingroup\$

C#, 85 67 bytes

class P{static void Main(){System.Console.Write("Hello, World!");}}

I guess it cannot get worse. Did not even beat Java this time.

\$\endgroup\$
4
  • 7
    \$\begingroup\$ class P{static void Main(){System.Console.WriteLine("Hello, World!");}} -- 71 bytes. More golfing you must do young padawan. \$\endgroup\$ Aug 28 '15 at 13:36
  • 7
    \$\begingroup\$ You don't need to specify the accessibility modifiers, C# will use defaults so you can remove both instances of public . You can also use the Write method on Console to save a few more bytes. \$\endgroup\$
    – user20151
    Aug 28 '15 at 13:36
  • 4
    \$\begingroup\$ The newline in the output is optional, so use Write instead of WriteLine to save 4 bytes \$\endgroup\$
    – SLuck49
    Aug 28 '15 at 15:49
  • \$\begingroup\$ Yeah, a lang of Microsoft is worse than Java! \$\endgroup\$
    – univalence
    Jul 18 '16 at 18:23
13
\$\begingroup\$

Cubix, 31 29 bytes

Saved 2 bytes thanks to @MartinBüttner

./v.o;@?/"!dlroW"S',u/"Hello"

I proudly present Cubix, my new 2-dimensional, stack-based esolang. Cubix is different from other 2D langs in that the source code is wrapped around the outside of a cube.

Test it online! You can now adjust the iteration speed if you want it to run faster or slower.

Explanation

The first thing the interpreter does is figure out the smallest cube that the code will fit onto. In this case, the edge-length is 3. Then the code is padded with no-ops . until all six sides are filled. Whitespace is removed before processing, so this code is identical to the above:

      . / v
      . o ;
      @ ? /
" ! d l r o W " S ' , u
/ " H e l l o " . . . .
. . . . . . . . . . . .
      . . .
      . . .
      . . .

Now the code is run. The IP (instruction pointer) starts out on the top left char of the far left face, pointing east. Here's an overview of the basic commands:

  • \|/_ are mirrors, and reflect the IP depending on the direction it's traveling.
  • >v<^ set the direction of the IP unconditionally.
  • ? turns the IP right if the top item is positive, or left if it's negative.
  • ' pushes the char code of the next char.
  • " toggles string mode, performing ' on each char until the IP encounters another ".
  • o outputs a char code.
  • ; pops an item.
  • @ ends the program.

The first char we encounter is ", which toggles string mode. Each char code is pushed to the stack until we run into the next ". Then we push a space with S, and a comma with ',. The stack now contains !dlroW ,.

Next we hit u, which turns the IP right, then right again before executing the next instruction. The IP is now at the far right of the fifth row in the above diagram, facing west. Now the IP executes "olleH", making the stack !dlroW ,olleH. The / points the IP south, where it travels through the bottom row of the bottom face, back up to the S (which adds an extra space), and finally hits the v.

Now the IP is in what I call the "output loop". First it moves down and hits the ;, which turns pops the unnecessary space. Then it hits the ?, which directs it through o to output, bounces back around to ; to pop the char, then comes back to ?.

This repeats until the stack is empty. Then, since the top of the stack is no longer truthy, ? leaves the IP headed north. The next char is @, which terminates the program.

I'm not sure if this program is optimal; there's four two no-ops which could probably be put to better use. Martin and I will keep looking to find a better solution.

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

Hexagony, 30 29 bytes

H;_e;r;2l.;P.QW;l/P1;@;0d;\o;

Try it online!

Source laid out:

    H ; _ e
   ; r ; 2 l
  . ; P . Q W
 ; l / P 1 ; @
  ; 0 d ; \ o
   ; . . . .
    . . . .

One more byte off!

Here's a crappy gif of the program in action.

29 byte gif

Given there's 2 nops inside the program itself, I'm confidant this can be golfed by at least one more byte. I'm willing to offer a bounty for a smaller version.

Old version:

H;e;r;0Pld;P_1;l;;o;Q\;W\;$2@\

Try it online!

Source laid out:

    H ; e ;
   r ; 0 P l
  d ; P _ 1 ;
 l ; ; o ; Q \
  ; W \ ; $ 2
   @ \ . . .
    . . . .

Reuses the same tricks as Martin Ender's answer, i.e Q2 printed is the comma, P0 is the space, P1 is the bang, but manages to be 2 bytes shorter through clever mirroring to reuse several ;s and the o.

Explanation:

Here's a coloured Hexagony grid to show the non-branching path that the pointer takes:

30 byte path

The executing code, ignoring mirrors, is:

H;e;l;;o;Q2;P0;W;d$;o;$2r;0Pl;Wd;P1;@

Filtering out the skipped instructions and the literals that are overwritten by other literals, we are left with:

H;e;l;;o;Q2;P0;W;o;r;l;d;P1;@

Which simply prints "Hello, World!"

After a few attempts, I gave up on a size 3 Hexagony answer. You need a minimum of 12 instructions out of 19 reserved for string literals, along with three ;s for printing and one @ for ending the program. This leaves only 3 spaces for IP management and memory management, provided you find the optimal path that reuses both the o and the l. From all this, I'll rule that a size 3 answer is impossible, though I'll give a sizable bounty to anyone who proves me wrong.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I posted a shorter solution. \$\endgroup\$
    – DELETE_ME
    May 19 '18 at 13:55
  • 1
    \$\begingroup\$ I came up with a 25-byte solution by hand - this will be my first answer here! I'm a bit miffed now to find this has already been beaten, albeit by brute force. Up until half an hour ago i thought Martin's original post was the only one for Hexagony. Still, my approach is different from the others. Hope to post soon although it may have to wait till Saturday when I get back from vacation and have access to my computer again. \$\endgroup\$ Aug 22 '18 at 20:29
  • \$\begingroup\$ @Oliphaunt It's been a while, but I noticed you never posted your 25 byte solution. Do you still have it or remember it? \$\endgroup\$
    – Jo King
    Sep 26 '19 at 2:51
12
\$\begingroup\$

Fission, 17 bytes

R"Hello, World!";

or

;"!dlroW, olleH"L

or any cyclic permutation of the two. In Fission, we need the R or L to release an atom and get control flow going. " toggles print mode, which just prints everything encountered until switched off. Finally ; destroys the atom to avoid an infinite loop.

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

PDP-11 (Unix) Assembly, 33 38 bytes

Source (No trailing newline required):

sys 4;10;15;sys 1;<Hello, World!>

Binary output:

0000000 000407 000026 000000 000000 000000 000000 000000 000000
0000020 104404 000010 000015 104401 062510 066154 026157 053440
0000040 071157 062154 000041 000000 000000 000000 000000 000000
0000060 000000 000000 000000 000000 000000 000000
0000074

The output is zero-padded to 60 bytes for some reason, but I know enough about the architecture to know that it doesn't matter and can be considered 38 (maybe 37) bytes. Unfortunately, while this works on the terminal, it actually prints to STDIN.

So, a correct program (I believe it exits with status 1, but that's not important) is:

5200;sys 4;12;15;sys 1;<Hello, World!>

That 5200 in the beginning is actually an "inc r0" instruction, but writing it in octal is shorter. Coincidentally, the length of this source code is also 38 bytes.

0000000 000407 000030 000000 000000 000000 000000 000000 000000
0000020 005200 104404 000012 000015 104401 062510 066154 026157
0000040 053440 071157 062154 000041 000000 000000 000000 000000

Output clocks in at 20 non-zero words, or 39 non-zero bytes, and this time the assembler doesn't insert quite as much padding so the actual output file size is 48 bytes.

Unobfuscated source for the same program:

inc r0
sys write; 0f; 13.
sys exit
0: <Hello, World!>

If you actually assemble this source the output has an extra nonzero byte (value 2) in the second-last word of the output, probably something to do with the fact that named symbols were used for the system calls.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ So is your answer optimized for short machine code, or for short source? Or both? Maybe post two header lines, one for the machine-code count and one for the asm source count? \$\endgroup\$ Apr 13 '18 at 0:52
12
\$\begingroup\$

Sed, 14 bytes

I'm hoping the sed exemption from no-input-rules applies here. If so, we can do:

cHello, World!

All that is required as input is one empty line.

\$\endgroup\$
3
  • \$\begingroup\$ cHello, World! \$\endgroup\$ Aug 28 '15 at 18:28
  • 1
    \$\begingroup\$ @MitchSchwartz excellent - I've never used the c sed command before - thanks! \$\endgroup\$ Aug 28 '15 at 18:56
  • \$\begingroup\$ Something like sed -e 'cHello, World!' <<<'' \$\endgroup\$
    – F. Hauri
    Dec 9 '18 at 13:41
12
\$\begingroup\$

gs2, 2 bytes

\x12h

where \x12 is a raw byte.

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

Z80Golf, 19 bytes

00000000: 674a 4343 4003 0f78 405d 434b 0e76 7e23  gJCC@..x@]CK.v~#
00000010: e5ee 2f                                  ../

Try it online!

Z80Golf is, essentially, a Z80 machine hooked up to $8000=putchar and $8003=getchar. The source code is a binary copied to $0000 (all other memory is zeroed out, just like the registers); execution starts there and runs until a halt instruction.

It was designed by mokehehe on anarchy golf for code golf competitions there, but seems to have fallen into disuse. It's really fun to golf in, but excelling in it requires a pretty thorough understanding of the Z80 chip (that I myself don't even have, but some golfers like kodera and *yuko* do, and every solution they write is very clever.)

A naïve Hello, World! program might look like this:

start:
  ld a, (ix+hello)
  or a
  jr nz, okay
  halt
okay:
  call $8000  ; putchar
  inc ix
  jr start
hello:
  db "Hello, World!"

It assembles into a 27 byte binary. It even cheats a little bit: we don't need to explicitly zero-terminate the string "Hello, World!" ourselves, as all the memory past our source code is zeroed already. And it's still a fair bit longer than our 19-byte solution.

So how does the 19-byte solution work?

It doesn't look much like a Hello, World! program when disassembled:

  ld h,a
  ld c,d
  ld b,e
  ld b,e
  ld b,b
  inc bc
  rrca
  ld a,b
  ld b,b
  ld e,l
  ld b,e
  ld c,e
  ld c,0x76
  ld a,(hl)
  inc hl
  push hl
  xor 0x2f

We can look at the program in a slightly more revealing manner.

  db 47 ^ 'H'  ; 67  ld h, a
  db 47 ^ 'e'  ; 4a  ld c, d
  db 47 ^ 'l'  ; 43  ld b, e
  db 47 ^ 'l'  ; 43  ld b, e
  db 47 ^ 'o'  ; 40  ld b, b
  db 47 ^ ','  ; 03  inc bc
  db 47 ^ ' '  ; 0f  rrca
  db 47 ^ 'W'  ; 78  ld a, b
  db 47 ^ 'o'  ; 40  ld b, b
  db 47 ^ 'r'  ; 5d  ld e, l
  db 47 ^ 'l'  ; 43  ld b, e
  db 47 ^ 'd'  ; 4b  ld c, e
  db 47 ^ '!'  ; 0e  ld c,
  halt         ; 76        $76
  ld a, (hl)
  inc hl
  push hl
  xor 47
               ; 32749 nop instructions, and then:
               ; putchar(A)
               ; ret

Whenever the PC becomes $8000, Z80Golf is programmed to write the byte in register A to STDOUT, and then effectively execute a ret (the PC is set to (SP) and SP is incremented by 2). In our code, instead of using call $8000 to access this behavior, we let the PC wade through a sea of nops (opcode 00) from $0013 to $7fff.

Keeping this in mind, the code will run as follows:

  • Execute some meaningless instructions (effectively NOPs), starting from ld h,a.
  • Set A to mem[0] ^ 47, which is 'H'.
  • Increment HL and push it ($0001).
  • Fall through to putchar, and return to the $0001 we pushed.
  • Execute some meaningless instructions, starting from ld c,d this time.
  • Set A to mem[1] ^ 47, which is 'e'.
  • Increment HL and push it ($0002).
  • Fall through to putchar, and return to the $0002 we pushed.
  • Set A to mem[12] ^ 47, which is '!'.
  • Fall through to putchar, and return to the $000d we pushed.
    • We finally jump into the argument of the ld c, $76 — and $76 is the halt opcode!

Of course, the constant 47 was carefully picked so that none of the first instructions 13 influence the execution of the code, and the last one is some opcode that takes a single-byte argument, “hiding” the halt opcode until we jump there after printing '!'.

\$\endgroup\$
11
\$\begingroup\$

Javascript, 22 bytes

alert("Hello, World!")

You don't NEED semicolons in Javascipt!

\$\endgroup\$
5
  • \$\begingroup\$ Don't you need them? \$\endgroup\$ Apr 14 '16 at 21:19
  • \$\begingroup\$ Apparently not for 1 liners (I don't know JS golfably) \$\endgroup\$
    – Blue
    Apr 14 '16 at 21:21
  • 1
    \$\begingroup\$ The JS interpreter will automatically insert them where it thinks they should be, if they aren't present \$\endgroup\$
    – bren
    May 8 '16 at 22:54
  • \$\begingroup\$ It does not print to stdout like the spec says \$\endgroup\$ Jun 1 '16 at 19:45
  • 2
    \$\begingroup\$ @ValentinLorentz Javascript doesn't have a stdout - I used the nearest alternate; see Default for Code Golf: Input/Output methods \$\endgroup\$
    – Blue
    Jun 1 '16 at 19:48
11
\$\begingroup\$

GNU Make, 27

$(info Hello, World!)
a:;@:
\$\endgroup\$
1
  • \$\begingroup\$ You can stick these two lines together, in either order, on one line to eliminate one more char. \$\endgroup\$ Mar 19 '17 at 8:48
11
\$\begingroup\$

Carrot (version: ^3), 13 bytes

Carrot is a language of Κριτικσι Λίθος. The syntax is stack^commands, where the stack is a string, and the interpreter outputs everything that's on the stack at the end of the program. The carrot is optional if you have no commands.

Hello, World!

In version ^, the carrot wasn't optional yet if you had no commands, so then it was 14 bytes:

Hello, World!^
\$\endgroup\$
5
  • 1
    \$\begingroup\$ +6 carrot.png \$\endgroup\$ Nov 1 '15 at 18:11
  • \$\begingroup\$ Write the version number as "^". \$\endgroup\$
    – user41805
    Nov 2 '15 at 5:51
  • \$\begingroup\$ @ΚριτικσιΛίθος Sure! Done. \$\endgroup\$
    – ProgramFOX
    Nov 2 '15 at 6:40
  • \$\begingroup\$ Version ^3 makes the ^ optional is you do not want to use any commands. Thus this can be shortened down by one byte. \$\endgroup\$
    – user41805
    Nov 3 '15 at 8:40
  • \$\begingroup\$ @ΚριτικσιΛίθος Cool! Added that. \$\endgroup\$
    – ProgramFOX
    Nov 3 '15 at 8:43
11
\$\begingroup\$

VSL, 35 33 bytes

Saved 2 bytes thanks to @ASCII-Only

fn main(){print("Hello, World!")}

Try it online!

Okay after over one year development, the day has come where I can post this :D

There is a print("Hello, World!") function but this is shorter. As I seperate libc and libvsl this will probably have to switch over to print but for now this is the shortest.

\$\endgroup\$
1
  • \$\begingroup\$ Using fn can save two bytes \$\endgroup\$
    – ASCII-only
    Apr 11 '18 at 3:16
10
\$\begingroup\$

Mouse, 19 bytes

"Hello, World"33!'$

Oddly enough, ! inside of a string makes a newline, so we have to work around that by getting the ASCII code for !, which is 33, and outputting that as a character.

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

Pancake Stack, 1118 1073 bytes

Put this supercalifragilisticexpialidociouseventhoughthesoundofitissomethingquite pancake on top!
Show me a pancake!
Put this floccinaucinihilipilification pancake on top!
Put the top pancakes together!
Show me a pancake!
Put another pancake on top!
Put this piquant pancake on top!
Put the top pancakes together!
Show me a pancake!
Show me a pancake!
Put another pancake on top!
Put this big pancake on top!
Put the top pancakes together!
Show me a pancake!
Put this osteosarchaematosplanchnochondroneuromuelous pancake on top!
Show me a pancake!
Put this kolmivaihdekilowattituntimittari pancake on top!
Show me a pancake!
Put the top pancakes together!
Put this scrumptious pancake on top!
Put the top pancakes together!
Show me a pancake!
Eat the pancake on top!
Show me a pancake!
Put this big pancake on top!
Put the top pancakes together!
Show me a pancake!
Eat the pancake on top!
Show me a pancake!
Eat the pancake on top!
Take off the syrup!
Show me a pancake!
Put this nonilfenossipolietilenossietonolo pancake on top!
Show me a pancake!
Eat all of the pancakes!

I've been avoiding this one because I haven't found a good way of golfing it yet, but here's a submission for now.

The relevant operations are:

Instruction                               Result
--------------------------------------------------------------------------
Put this X pancake on top!                Push word length of X to stack
Eat the pancake on top!                   Pop and discard
Put the top pancakes together!            Add top two
Put another pancake on top!               Duplicate
Show me a pancake!                        Print as ASCII without popping
Take off the syrup!                       Decrement all stack values by 1
Eat all of the pancakes!                  Terminate program

If you take a look a Pancake Stack's full instruction set, you'll notice that you only ever have access to the top two stack elements at any time, which makes this language a pain to program in normally. That and the fact that you can only output as ASCII, i.e. no numeric output.

Note that, if you're using the Python interpreter, you'll need an extra line with a ~ afterwards if you want to test by piping in a file. We don't use it here, but anything after the ~ is treated as normal STDIN input.

\$\endgroup\$
10
\$\begingroup\$

Ziim, 1222 bytes

In an unexpected turn of events, I'm counting this submission in UTF-16.

↘ ↓↘↘↘↘↙↓↘↘ ↙↓↘ ↓↘ ↙↘←↓ ↘↘↙↓↘↘↘↙↓↘↘↘↘↙↓↘↘↘↘↙↓ ↘↘↙↓↘↘↙↓↘ ↙ ↘ ↓↘ ↙↘←↓↘ ↙ ↘ ↓ ↘↘↙↓↘↘↙↓↘↘↘↘↙↓ ↘ ↙↘←↓↘ ↙ ↘ ↓ ↘ ↙ ↘ ↓↘↘↙↓↘↘↘↙↓↘↘↘↙↓↘↘ ↙↓↘←↓↘ ↙↓↘ ↓↘↘↙↓ ↘↘↙↓↘↘↙↓↘ ↙↘←↓↘ ↙↘←↓ ↘ ↙↘←↓ ↘↘↙↓↘↘↙↓ ↘ ↙ ↘ ↓↘↘ ↙ ↘ ↓↘ ↙↓↘←
↓→↘ ↑↑↓→↘ ↑↓  ↓→↘ ↓↓↓→↘↘ ↓→↘ ↑↓→↘ ↑↑↓→↘ ↑↑↓→↘↘ ↓→↘ ↓→↘ ↓↓↓↓→↘ ↓↓↓→↘ ↓↓↓↓→↘↘ ↓→↘ ↓→↘ ↑↑↓→↘↘ ↓↓↓→↘ ↓↓↓↓→↘↘ ↓↓↓↓→↘ ↓→↘ ↑↓→↘ ↑↓→↘ ↑↓  ↓→↘ ↓  ↓→↘ ↓→↘↘ ↓→↘ ↓→↘ ↓↓↓→↘ ↓↓↓→↘↘ ↓↓↓→↘↘ ↓→↘ ↓→↘↘ ↓↓↓↓→↘ ↑↓↓↓↓→↘ ↓  ↓→
↗  ↑↖ ↗  ↑↖↗↑↗↗  ↑↗↗↗  ↑↑↗  ↑↖↗  ↑↖ ↗  ↑↖ ↗  ↑↑↗  ↑↗  ↑↗↗↗↗  ↑↗↗↗  ↑↗↗↗↗  ↑↑↗  ↑↗  ↑↖ ↗  ↑↑↗↗↗  ↑↗↗↗↗  ↑↑↗↗↗↗  ↑↗  ↑↖↗  ↑ ↗  ↑↖↗↑↗↗  ↑↗↑↗↗  ↑↗  ↑↑↗  ↑↗  ↑↗↗↗  ↑↗↗↗  ↑↑↗↗↗  ↑↑↗  ↑↗  ↑↑↗↗↗↗  ↑↖↗↗↗↗  ↑↗↑↗↗

Because the code snippet above will likely not render in a very readable manner for you (either because of missing characters, or because the diagonal arrows aren't as monospaced as they should be), here is an image of the solution. I've marked the concatenators where a new byte starts in red:

enter image description here
Click for larger version

Well, this is a bit embarrassing. I spent quite some time on this solution, and at 610 characters, it is 267 characters shorter than the one on the esolangs page. However, it contains a lot more arrows, and because those are 3 bytes in UTF-8, it's actually longer than the one on esolangs (1516 vs 1345). But because this solution is so dense and contains far more arrows than spaces, I'm actually saving bytes by using UTF-16 and counting each character as two bytes.

Anyway, regardless of how we're counting, this is far from optimal. The above code is entirely linear, and builds one bit at a time. So I'm not reusing any bitstrings (like I could for the ls or os or even other substrings). I chose this approach because I wanted to start with something where it would be easier to pack the arrows very densely. If one used a more square layout, one could make use of a lot more repetition in the output (on a bit level), and thereby make massive savings.

\$\endgroup\$
4
  • \$\begingroup\$ Most 2d languages are generally scored by the area of the bounding box, why not do that here? \$\endgroup\$ Jan 29 '16 at 17:31
  • \$\begingroup\$ @SuperJedi224 [citation-needed]? I've never scored any 2D language like that and the only one which I've seen like that is Piet where I think that's not how we should do it. \$\endgroup\$ Jan 29 '16 at 17:40
  • \$\begingroup\$ I've definitely seen befunge and <>< scored that way before, and that's how I've generally been scoring BotEngine. \$\endgroup\$ Jan 29 '16 at 17:56
  • 2
    \$\begingroup\$ @SuperJedi224 if I saw that I would recommend changing it. Programs should be scored by the size of the source file and I don't know any 2D language that chokes on omitted trailing spaces. Plus, if a submission did use up the entire bounding box, you wouldn't be counting any bytes for the aspect ratio of the grid, which is also important information. \$\endgroup\$ Jan 29 '16 at 18:11
10
\$\begingroup\$

Foo, 14 bytes

"Hello, World!

Not printing Hello World seems to be a lot harder in Foo that the opposite...

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ Would s print Hello World? ;) \$\endgroup\$ Apr 14 '16 at 21:18
  • \$\begingroup\$ Probably. \$\endgroup\$
    – Dennis
    Apr 14 '16 at 21:20
  • \$\begingroup\$ If you find out, you might be able to golf it down to 0 or 1 byte! \$\endgroup\$ Apr 14 '16 at 21:22
10
\$\begingroup\$

Labyrinth, 46 45 40 bytes

72.10:1.:8:..:):1:.#2#4..:1..4.:8.0.33.@

Try it online!

Labyrinth is my new two-dimensional programming language (although the 2D'ness isn't really used here). Labyrinth operates on two stacks (although this code only uses one). Each character is a separate command. However, as opposed to most similar languages individual digits don't push that digit (which makes it annoying to build up larger numbers), instead they multiply the top of the stack by 10 before adding themselves. This allows you simply to write out the numbers you want to push. (Another language with this concept is Emmental.)

The other commands you need to know for the above code are . which prints the top of the stack (modulo 256), : which duplicates the top of the stack, ) which increments it and # which pushes the current stack depth. @ terminates the program. There's only one tricky part: W is printed by appending a 1 to 111 (o), because 1111 % 256 = 87.

Here is what the stack and output look like throughout the program:

Command(s)  Stack               Output
72          [72]                ><
.                               >H<
10          [10]                >H<
:           [10 10]             >H<
1           [10 101]            >H<
.           [10]                >He<
:           [10 10]             >He<
8           [10 108]            >He<
:           [10 108 108]        >He<
..          [10]                >Hell<
:           [10 10]             >Hell<
)           [10 11]             >Hell<
:           [10 11 11]          >Hell<
1           [10 11 111]         >Hell<
:           [10 11 111 111]     >Hell<
.           [10 11 111]         >Hello<
#           [10 11 111 3]       >Hello<
2           [10 11 111 32]      >Hello<
#           [10 11 111 32 4]    >Hello<
4           [10 11 111 32 44]   >Hello<
..          [10 11 111]         >Hello, <
:           [10 11 111 111]     >Hello, <
1           [10 11 111 1111]    >Hello, <
..          [10 11]             >Hello, Wo<
4           [10 114]            >Hello, Wo<
.           [10]                >Hello, Wor<
:           [10 10]             >Hello, Wor<
8           [10 108]            >Hello, Wor<
.           [10]                >Hello, Worl<
0           [100]               >Hello, Worl<
.           []                  >Hello, World<
33          [33]                >Hello, World<
.           []                  >Hello, World!<
@
\$\endgroup\$
3
  • 1
    \$\begingroup\$ This maybe could be golfed more if you allow the code to intersect itself. \$\endgroup\$ Aug 29 '15 at 14:24
  • \$\begingroup\$ I really don't understand why "1111" is a "W". The ascii code for 'W' is 87. Can somebody explain this to me? \$\endgroup\$ May 25 '17 at 15:29
  • \$\begingroup\$ Oh, I see the explanation in the description, but I wasn't aware that . did a % 256 before printing. \$\endgroup\$ May 25 '17 at 15:41
10
\$\begingroup\$

ELF 32-bit LSB executable (Linux), 59 bytes

0000000: 7f 45 4c 46 01 00 00 00 00 00 00 00 00 90 43 0d  .ELF..........C.
0000010: 02 00 03 00 19 90 43 0d 19 90 43 0d 04 00 00 00  ......C...C.....
0000020: b9 2e 90 43 0d b2 0d cd 80 cc 20 00 01 00 48 65  ...C...... ...He
0000030: 6c 6c 6f 2c 20 57 6f 72 6c 64 21                 llo, World!

This exits with INT 3 (breakpoint), so your shell may display a message to indicate this. However, the program itself prints nothing to STDERR.

Try it online!

Verification

$ cksum hw32
3205536342 59 hw32
$ ./hw32
Hello, World!Trace/breakpoint trap
$ ./hw32 | cat; echo
Hello, World!
$ ./hw32 | xxd -g 1
0000000: 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21           Hello, World!
\$\endgroup\$
1
  • \$\begingroup\$ or echo $(./hw32) \$\endgroup\$
    – F. Hauri
    Dec 9 '18 at 13:53
10
\$\begingroup\$

USML, 9 bytes

S0h7cWs8h

Try it online!

Explanation:

S0h7cWs8h
S0h7       # Get characters 0-7 of h ("Hello, world!").
    cW     # Get the character "W"
      s8h  # Get the remaining characters, starting at character 8, of h.

This program is an interesting problem, as it has a command that outputs "Hello, world!" (and an empty program will also do this), but the capitalization is not correct. As a result, we need to take some substrings and add in the correct character.

\$\endgroup\$
1
  • 8
    \$\begingroup\$ This is probably the first interesting use of a HW-built-in I've seen in this challenge. \$\endgroup\$ Apr 8 '17 at 22:15
10
\$\begingroup\$

LLVM IR 4.0.1, 149 145 152 bytes

declare i8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)@puts(i8*getelementptr([14 x i8],[14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it's possible with fewer bytes.

Ungolfed Version:

declare i8 @puts(i8*) ; Declare puts from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*) @puts(i8* getelementptr([14 x i8], [14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to puts
    ret void
}
\$\endgroup\$
2
  • \$\begingroup\$ would int main be smaller, with ret 0 instead of ret void? I don't know LLVM IR at all, really >.< \$\endgroup\$ Apr 13 '18 at 0:54
  • \$\begingroup\$ You can put a raw null byte instead of \00, do call i8@puts, and use [14x i8] to save space \$\endgroup\$
    – EasyasPi
    Dec 30 '20 at 20:39
9
\$\begingroup\$

R, 20 bytes

cat("Hello, World!")
\$\endgroup\$
9
\$\begingroup\$

Prelude, 38 bytes

92480969393782833909095806(^+^+^^+++!)

If you're using the Python interpreter, you'll need to make sure that NUMERIC_OUTPUT is set to False.

Prelude is a relatively simple stack-based language, with 0-9 pushing the corresponding single digits and the only arithmetic being addition and subtraction. In particular, there is no multiplication.

To make the most of the single digit pushing behaviour, I took a look at the code points in various bases. For base 12, we get this:

[[6 0] [8 5] [9 0] [9 0] [9 3] [3 8] [2 8] [7 3] [9 3] [9 6] [9 0] [8 4] [2 9]]

Everything here is a single digit - that's perfect! This means that we can encode each character using two digits via base 12, e.g. H -> 72 (base 10) -> 60 (base 12). That's what the long string of 26 digits at the beginning is for.

The back half of the code then needs to take each pair of digits a, b and give 12*a+b. But remember, Prelude doesn't have multiplication! What it does have, however, is ^ and v, which get the top stack values from the program rows ("voices") above and below. Since this is a one-line program, ^ effectively duplicates the top of the stack, allowing us to do ^+^+^^++ to multiply the top stack element by 12. We then add the second digit with + and output with !. All of this is wrapped in (), which is a BF-like loop which executes while the top stack element is nonzero.

\$\endgroup\$
9
\$\begingroup\$

COBOL, 55 bytes

PROGRAM-ID.H.PROCEDURE DIVISION.DISPLAY"Hello, World!".

Thankfully not quite as verbose as some ancient bloated languages like Java.

\$\endgroup\$
3
  • 3
    \$\begingroup\$ You're cheating. Last I checked, COBOL needed a lot of newlines and useless spaces at the start of each line... \$\endgroup\$ Dec 15 '15 at 11:05
  • \$\begingroup\$ When I compile that at tutorialspoint.comcompile_cobol_online.php it says Error: syntax error, unexpected "end of file", expecting "FUNCTION-ID" or "PROGRAM-ID" because it doesn't like the missing newlines. The exact same code on three lines compiles and runs. \$\endgroup\$ Mar 17 '16 at 23:34
  • 1
    \$\begingroup\$ @JerryJeremiah This works just fine with GNU COBOL, assuming you provide the -F (or -free) flag. tio.run/##S85Pys/RTc8r/f8/… \$\endgroup\$
    – Dennis
    Jul 17 '17 at 20:45
9
\$\begingroup\$

???, 96 bytes

,;;..;...;.;,,,,;,,"......";...........-,'",-.";;,,,,!;...!;,!!...!;;;!-!-!-!...!,,,,,,!-,!;;;.!

Based on the 95-byte approach by Mitch Schwartz.

Note that the 92-byte Brainfuck solution would yield 97 bytes in ???, because the sequential loops require four more apostrophes.

\$\endgroup\$
2
  • 24
    \$\begingroup\$ This is... wait, wrong challenge. \$\endgroup\$
    – Dennis
    Aug 29 '15 at 4:38
  • \$\begingroup\$ 80 bytes \$\endgroup\$
    – ASCII-only
    Apr 12 '18 at 5:24
9
\$\begingroup\$

Emotinomicon, 18 characters / 30 bytes

Try it here.

😭!dlroW ,olleH😲⏪⏬⏩

Explanation:

😭  !dlroW ,olleH   😲  ⏪   ⏬   ⏩   explanation
😭                                   begin quote string
    !dlroW ,olleH                   
                    😲               end quote string
                        ⏪           open loop
                            ⏬       pops and outputs top of stack as character
                                ⏩   close loop
\$\endgroup\$
0
9
\$\begingroup\$

05AB1E, 14 7* bytes

*14 bytes for the use of the trademarked Ÿ

Code:

”Ÿ™,‚ï!

Try it online!

Like Jelly, this uses a compression method using an English dictionary. How it works? Let's find out:

”       # Start a compressed string with all words titlecased
 Ÿ      # In Info.txt, you can see that this has index 24
  ™     # Index 19
        # These two indexes combined is 2419, in the dictionary you can see that the
          2419th word is hello
   ,    # Since this has no index, this will be interpreted as a normal character
    ‚ï  # Index 0118, which is the word "world". An extra space before this word is
        # implicitly added.
      ! # Regular exclamation mark
        # All the compressed words are automatically title cased.
          resulting in: "Hello, World!"
        

This uses CP-1252 encoding

Previous version:

"Hello, World!
\$\endgroup\$
2
  • 12
    \$\begingroup\$ Ÿ™, That's right, I just trademarked Ÿ. You cannot use it without doubling your code golf score :P \$\endgroup\$ Feb 11 '16 at 23:37
  • 3
    \$\begingroup\$ @CᴏɴᴏʀO'Bʀɪᴇɴ Hahaha, fair enough then :p \$\endgroup\$
    – Adnan
    Feb 12 '16 at 11:50
1 2
3
4 5
29

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.