467
\$\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\$ – Martin Ender 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\$ – aditsu quit because SE is EVIL 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\$ – Martin Ender 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\$ – Martin Ender 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\$ – user202729 May 20 '18 at 10:20

831 Answers 831

1
10 11
12
13 14
28
3
\$\begingroup\$

MAWP, 86 62 bytes

89W!;74WM1M!;7M!!;;3M;66W8M;84W;99W6M!;64WM!;3M!;6A!;8A;66W3A;

Try it!

\$\endgroup\$
1
  • \$\begingroup\$ 64 bytes \$\endgroup\$ – lyxal Aug 14 '20 at 21:32
3
\$\begingroup\$

Fugue, 276 bytes

00000000: 4d54 6864 0000 0006 0001 0002 0001 4d54  MThd..........MT
00000010: 726b 0000 001b 0090 4040 0190 3c40 0090  rk......@@..<@..
00000020: 4640 1b90 4440 0390 4240 0190 4740 00ff  F@..D@..B@..G@..
00000030: 2f4d 5472 6b00 0000 db00 905c 4001 905d  /MTrk......\@..]
00000040: 4001 9059 4000 905c 4001 9058 4000 904e  @..Y@..\@..X@..N
00000050: 4001 904f 4001 904b 4000 9049 4001 904a  @..O@..K@..I@..J
00000060: 4001 9046 4000 904a 4001 904b 4001 9047  @..F@..J@..K@..G
00000070: 4000 9048 4001 9049 4001 904a 4001 9046  @..H@..I@..J@..F
00000080: 4000 904d 4001 904e 4001 904a 4000 904c  @..M@..N@..J@..L
00000090: 4001 9048 4000 9048 4001 9044 4000 9048  @..H@..H@..D@..H
000000a0: 4001 9044 4000 9045 4001 9046 4001 9042  @..D@..E@..F@..B
000000b0: 4000 9040 4001 9041 4001 903d 4000 903b  @..@@..A@..=@..;
000000c0: 4001 903c 4001 9038 4000 902f 4001 9030  @..<@..8@../@..0
000000d0: 4001 902c 4000 9027 4001 9023 4000 902a  @..,@..'@..#@..*
000000e0: 4001 9031 4002 9032 4001 9037 4003 9038  @..1@..2@..7@..8
000000f0: 4001 9039 4001 903a 4001 903f 4001 9044  @..9@..:@..?@..D
00000100: 4001 9049 4001 904e 4001 9056 4001 904f  @..I@..N@..V@..O
00000110: 4000 ff2f                                @../

This answer uses the same process as Sp3000's Prelude answer. However, since Fugue can push any integer from -10 to 10, I use the upper voice to store the constant 10 (since copying a value takes one fewer instruction than pushing a new one) and then convert from base 11. The compiler is rather old and can be tricky to use; my usual process (on x86-64 Linux) is to use the commands:

gcc -Dstricmp=strcasecmp -Wno-format -o fugue_x86 fugue_x86.c

xxd -r hello.bin > hello.midi
./fugue_x86 hello.midi /coffc
gcc -D__cdecl= -Dfugue=_fugue -m32 -o hello hello.obj hello_wrp.c

Note that this program is not a valid MIDI file due to the missing length fields after the 2F meta-events. I didn't optimize it at all for musicality, but if you still want to listen to it, here is an equivalent MIDI file:

00000000: 4d54 6864 0000 0006 0001 0002 0001 4d54  MThd..........MT
00000010: 726b 0000 001c 0090 4040 0190 3c40 0090  rk......@@..<@..
00000020: 4640 1b90 4440 0390 4240 0190 4740 00ff  F@..D@..B@..G@..
00000030: 2f00 4d54 726b 0000 00dc 0090 5c40 0190  /.MTrk......\@..
00000040: 5d40 0190 5940 0090 5c40 0190 5840 0090  ]@..Y@..\@..X@..
00000050: 4e40 0190 4f40 0190 4b40 0090 4940 0190  N@..O@..K@..I@..
00000060: 4a40 0190 4640 0090 4a40 0190 4b40 0190  J@..F@..J@..K@..
00000070: 4740 0090 4840 0190 4940 0190 4a40 0190  G@..H@..I@..J@..
00000080: 4640 0090 4d40 0190 4e40 0190 4a40 0090  F@..M@..N@..J@..
00000090: 4c40 0190 4840 0090 4840 0190 4440 0090  L@..H@..H@..D@..
000000a0: 4840 0190 4440 0090 4540 0190 4640 0190  H@..D@..E@..F@..
000000b0: 4240 0090 4040 0190 4140 0190 3d40 0090  B@..@@..A@..=@..
000000c0: 3b40 0190 3c40 0190 3840 0090 2f40 0190  ;@..<@..8@../@..
000000d0: 3040 0190 2c40 0090 2740 0190 2340 0090  0@..,@..'@..#@..
000000e0: 2a40 0190 3140 0290 3240 0190 3740 0390  *@..1@..2@..7@..
000000f0: 3840 0190 3940 0190 3a40 0190 3f40 0190  8@..9@..:@..?@..
00000100: 4440 0190 4940 0190 4e40 0190 5640 0190  D@..I@..N@..V@..
00000110: 4f40 00ff 2f00                           O@../.
\$\endgroup\$
3
\$\begingroup\$

Kotlin, 33 bytes

fun main()=print("Hello, World!")

This is probably the shortest you can go.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to Code Golf, nice first answer! \$\endgroup\$ – Redwolf Programs Feb 10 at 15:27
3
+100
\$\begingroup\$

Sandwich, 14 bytes

pHello, World!

Explanation: Sandwich is comprised of opcodes. The first letter of each line is the opcode, and the rest of the line is the arguments. This example has the opcode p, which means print. The rest of the line says Hello, World!, which are the arguments to the p opcode.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Welcome to Code Golf, and nice first answer! There is this category of bounties for new and interesting languages, I've let the bounty awarder know about the language \$\endgroup\$ – caird coinheringaahing Apr 15 at 14:28
  • \$\begingroup\$ Hi! As caird said, I've got a bounty for new and interesting languages. I'd be willing to give this answer a bounty of +100 reputation, or if you think you could demonstrate more of the language's features in another answer I could award it to that instead. \$\endgroup\$ – Redwolf Programs Apr 15 at 14:34
  • \$\begingroup\$ @RedwolfPrograms This answer is fine, thanks! \$\endgroup\$ – Y45HK4R4ND1K4R Apr 15 at 14:36
  • \$\begingroup\$ @Y45HK4R4ND1K4R Bounty started! \$\endgroup\$ – Redwolf Programs Apr 15 at 14:39
3
\$\begingroup\$

10IPL, 67 bytes

00010000 00100000 00100000 00100000 00010000 00100000 00100000 00100000 00110000 00010010 00100010 00100010 00010010 00100010 00010010 00100010 00100010 01000001 00010000 00110000 00010100 00100100 00100100 00100100 00010100 01000010 00110000 00110000 00010000 00010000 00010000 00110000 00110010 00010110 00100110 00100110 00100110 00100110 01100011 00100110 00110110 00010100 00010100 00010100 00100100 01010000 00110100 00110000 00010000 00010000 00010000 00110000 00010100 00010100 00010100 00010100 00010100 01010100 00110100 00011010 00101010 00101010 00101010 01010101 00110100 00010110 00110110

Try it online!

Program:

inr r0
rtr r0
rtr r0
rtr r0
inr r0
rtr r0
rtr r0
rtr r0

prt r0

inr r1
rtr r1
rtr r1
inr r1
rtr r1
inr r1
rtr r1
rtr r1
xor r0, r1
inr r0

prt r0

inr r2
rtr r2
rtr r2
rtr r2
inr r2
xor r0, r2

prt r0
prt r0

inr r0
inr r0
inr r0

prt r0

prt r1

inr r3
rtr r3
rtr r3
rtr r3
rtr r3
xor r4, r3
rtr r3

prt r3

inr r2
inr r2
inr r2
rtr r2
xor r2, r0

prt r2

prt r0

inr r0
inr r0
inr r0

prt r0

inr r2
inr r2
inr r2
inr r2
inr r2
xor r2, r4

prt r2

inr r5
rtr r5
rtr r5
rtr r5
xor r2, r5

prt r2

inr r3
prt r3

What is 10IPL?

10IPL, short for 10 Instruction Programming Language, is a simple compiled language I made for use in a computer I'm building in Minecraft. I made an online interpreter for it (with a few extra features), since I think it's a neat language.

How does this work?

This program doesn't have anything fancy, it just uses three of 10IPL's instructions (Increment, Rotate, and XOR) to put numbers in registers, then prints them.

10IPL has four general purpose registers, r0 to r3. It also has r4 (or rp0) and r5 (or rp1), which are intended to hold pointers. I use these as normal registers to save having to waste bytes clearing the ones I've already used, since this program never needs to access memory.

\$\endgroup\$
3
\$\begingroup\$

Yggdrasil, 29 bytes

;H;e;l;l;o;,; ;W;o;r;l;d;!(")

Try it online!

Introducing Yggdrasil! This is a self-modify esolang based on binary trees. The program and it's memory model are both mapped to the same binary tree, then executed on that same tree. For example, this program is mapped to

                          ;
                         / \
                        ;   H
                       / \
                      ;   e
                     / \
                    ;   l
                   / \
                  ;   l
                 / \
                ;   o
               / \
              ;   ,
             / \
            ;   ␠
           / \
          ;   W
         / \
        ;   o
       / \
      ;   r
     / \
    ;   l
   / \
  ;   d
 / \
(   !

The ; command takes the next 2 tokens and forms a binary branch from them. All the other symbols in the tree are no-ops, they just set the value of that leaf to their Unicode code point. You'll note that ") are not nodes in the tree. Yggdrasil ignores any trailing symbols that don't fit into the tree.

Once we've established our memory tree, we then begin executing the code, character by character. ;H;e;l;l;o;,; ;W;o;r;l;d;! all have absolutely no effect, so the pointer remains at the program root (the first ;). We then find a "traversal", bounded by (...). This takes the code inside the brackets and runs it over each node in the tree that has arguments (i.e. is not a leaf). The code here is just " (output right node as character), so the program goes to each ; and outputs it's right node as a character.

\$\endgroup\$
1
  • \$\begingroup\$ oh, your code itself formats onto a binary tree? that's very cool :D \$\endgroup\$ – hyper-neutrino Apr 17 at 17:55
3
\$\begingroup\$

Branch, 42 bytes

72.101.108Z..111O.44.32.87.o.114.z.100.33.

Try it on the online Branch interpreter!

Explanation

Each number sets the value of the current node to that. . outputs as a character. N-Z set a numerical register and n-z set the value to the value of that register. I won't give a character-by-character analysis; this basically just loads each value and outputs it, using registers to save some bytes. It's not a particularly interesting solution.

\$\endgroup\$
3
\$\begingroup\$

yuno, 2 bytes

」オ

No TIO link unfortunately, because I'm not good at setting this sort of stuff up and I don't want to accidentally make my server insecure (especially since I'm sharing it with a friend). You can clone the repository from the link in the header though. I promise I did not intentionally code malware. I can't guarantee nothing weird will happen though because I suck at coding, only that I don't have malicious intent.

This language is in its very early stages. It has very few things implemented right now, but it exists and by posting an answer and publicizing it maybe it'll force me to actually write it instead of giving up like half of my other language ideas so far, lol.

Explanation

Since is a string terminator, it's not mapped to anything in the normal string system, and therefore when represented as a single character, I special-cased it to Hello, World. ends a string normally, but like in Jelly, when used without an open quote, it acts as a character literal, but in this case, it maps its codepage to latin characters.

A non-built-in solution would be 「Hello、 Wリョld! (the can be ommitted), based on how character mapping works.

The built-in can be written as ]o as well. The non-built-in can be written as [H_e_l_l_o, Wryo_l_d!.

Note: the non-built-in, despite looking like 14 characters (bytes in an SBCS), is actually 13 (you could use 「Hello、 World! for 14). This is because リョ is a single token and, if you read the code in binary, is mapped to one byte. You can read more about this on the wiki, which also mentions where to find the exact codepage in the repository. There are some three-byte tokens like ッキョ. You can check how many bytes a program is using the c flag or format it into a CGCC submission using the C flag.

No, I don't have a good explanation for why I used katakana as my codepage. Yes, you can use hiragana as well. If you call me a weeb I will 11 you. That is all.

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

Common LISP, 22 bytes

(princ"Hello, World!")
\$\endgroup\$
2
\$\begingroup\$

Burlesque, 17 bytes

,"Hello, World!"Q

The leading , tells Burlesque to ignore standard input. "Hello, World!" pushes a string to the stack, and Q formats it for display without quotes.

\$\endgroup\$
2
  • \$\begingroup\$ Yes, otherwise Burlesque will add "". \$\endgroup\$ – Lynn Oct 23 '15 at 21:25
  • \$\begingroup\$ Sure, that works just as well! The , primitive (it's sort of like a flag, I guess?) is there for historic reasons; Q is a new-ish synonym for sh which was longer. \$\endgroup\$ – Lynn Oct 23 '15 at 21:46
2
\$\begingroup\$

RPython, 60 bytes

def e():print'Hello, World!';return 0
target=lambda*_:e,None
\$\endgroup\$
2
\$\begingroup\$

awk, 25 bytes

END{print"Hello, World!"}
\$\endgroup\$
4
  • \$\begingroup\$ I know little of awk, but I think you can remove the END part. (It's June I know). \$\endgroup\$ – Erik the Outgolfer Jun 2 '16 at 19:30
  • \$\begingroup\$ Actually, if you use END, it requires some kind of input... the input can be empty but it seems to be needed on my version of AWK. You do need a label, though, otherwise nothing will happen. BEGIN works, but it adds 2 bytes. :( \$\endgroup\$ – Robert Benson Jul 19 '16 at 13:11
  • 1
    \$\begingroup\$ You're both right(ish). If you can invoke the one blank line of input rule you don't need the END, otherwise you must use BEGIN not END. \$\endgroup\$ – user3710044 Mar 19 '17 at 8:53
  • 1
    \$\begingroup\$ If the one-blank-input rule is allowed, this works too $0="Hello World!" \$\endgroup\$ – cnamejj Apr 14 at 10:06
2
\$\begingroup\$

Erlang, 63 bytes

Save as h.erl, then compile with erl -s h m, I think.

-module h.
-export[m/0].
m()->io:fwrite("Hello, World!").
\$\endgroup\$
2
\$\begingroup\$

Tcl, 19 bytes

puts Hello,\ World!

I think this can get smaller than it already is.

\$\endgroup\$
4
  • \$\begingroup\$ Is that missing the comma? \$\endgroup\$ – curiousdannii Aug 29 '15 at 13:00
  • \$\begingroup\$ What comma do you mean? \$\endgroup\$ – Johannes Kuhn Aug 29 '15 at 13:06
  • \$\begingroup\$ I'm just guessing, but will this print "Hello World!" rather than "Hello, World!"? \$\endgroup\$ – curiousdannii Aug 29 '15 at 13:10
  • \$\begingroup\$ Right... Forgot that piece... \$\endgroup\$ – Johannes Kuhn Aug 29 '15 at 13:12
2
\$\begingroup\$

Glypho, 480 bytes

In the "shorthand" format, it's 120 bytes:

1d+d1+d*+ddd++ddd++1+d11+d*d++d11+1+d++d1-dd+++d1<d>+-d++11+d*d*d+<d>d+d+d<d>+d+1+d1-dd+++d1-<d>+d*1+11+1+d+d*d+<d-+>[o]

An example conversion to "true" Glypho (using the translation of the Java interpreter, which differs slightly from that documented in the esolangs.org page) is:

v># #  :: < <   <v#  #*>*> ##:#**#,<,<: : > > *  *v>>v # ##,#, + +:++: ++ ##
*<<*,^,^<<#v<<v#v::v< < <,, +,+,+>>+*,,*+*+*,,*>**^v#  #,,:^#vv#>+>+ << >  >, , ++*>:
:v<v<^#^#v::v>::>v**v # #::>^>+>>:>:>>>*>>##>*^ *# #  vv ,::,<<>:++
*vv*v:v:^vv< > > ,,>>:>: << >+>>^ ^ ^^*^+,+,#::#*:*::  :v v  ,   # #<<#<#**#^,^,+##+**
+**+,:,:::>*<^v< v v+^+^*^^*+<<++##+v#v#++<>:< :* **+ +   ^ *  *<+<+<  *vv+<:^^:::
^+*<<***<^+  ++:+:^##^:>:>+::< > >#>># *  >,>, :^ ^>>^##<#,<,*^   *<:<

(using Windows line terminators \r\n) where I tried to disguise it as a 2D language for the Programming Language Quiz.

The basic approach is to push onto the stack a 0 followed by the codepoints in reverse order, and then print them with the loop [o]. In order to golf the pushing, I first push 11 and then I can push a new 11 whenever I want with <d>; the final <d-+> replaces that 11 on the bottom of the stack with the desired 0.

I experimented with various values on the bottom of the stack, and 11 is the only one for which my brute-force searcher was able to find expressions for each of the characters which were no more than 11 bytes each. (12 bytes was taking too long).

\$\endgroup\$
1
  • \$\begingroup\$ Quick translation from my CSL answer (i.e. super suboptimal), 456 \$\endgroup\$ – ASCII-only Apr 13 '18 at 6:32
2
\$\begingroup\$

23, 52 bytes

17,13,72,101,108,108,111,44,32,87,111,114,108,100,33

This uses 23.dezsy notation: 17,13 prints the 13 integers that follow as characters.

Try it online here. (Don't forget to replace the example with the above source code.)

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

Maxima, 23 bytes

print("Hello, World!")$
\$\endgroup\$
2
\$\begingroup\$

UNBABTIZED

:72.:101.:108.:108.:111.:44.:32.:87.:111.:114.:108.:100.:33

:x prints x as a character and . acts as a statement separator.

The official interpreter is written for Python 2.2. You can use it in modern versions of Python by prepending the line

# coding: latin1
\$\endgroup\$
2
\$\begingroup\$

az, 16 bytes

"Hello, World!".
\$\endgroup\$
2
\$\begingroup\$

Cardinal, 15 bytes

%"Hello, World!
\$\endgroup\$
2
\$\begingroup\$

LMNtal, 35 bytes

io.use.io.print("Hello, World!",_).

A weird programming language from Japan that seems to be inspired by Prolog.

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

Fishing, 37 bytes

v+CCCCCCCCCCCCCCCC
  `Hello, World!`N

I don't think there's anything to golf beyond the example listed on the esolangs page, so I didn't really write this myself. Hence, community wiki.

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

HPPPL, 44 43 bytes

HP Prime Programming Language for the HP Prime color graphing calculator.

export h()begin print("Hello, World!");end;

(golfed down by one byte, thanks to kirbyfan64sos!)

Output:

Hello, World! HPPPL

This is a full program that you call by entering h to start it.

If you just want to have the output to the terminal, then a shorter (22 bytes) version in Home Mode works, too:

print("Hello, World!")

A free emulator is available here: http://www.hp-prime.de/en/category/13-emulator

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Is the space between the right parenthesis and begin needed? \$\endgroup\$ – kirbyfan64sos Sep 1 '15 at 13:55
  • \$\begingroup\$ @kirbyfan64sos Thanks for the hint. No, it’s not necessary. \$\endgroup\$ – M L Sep 1 '15 at 14:30
2
\$\begingroup\$

RUBE, 47 bytes

A cellular automaton-based language about warehouses, crates, dozers, and conveyor belts:

2
1
766
2c4
256
07f
662
cfc
466
85c
OOO
ccc
===

It turns out stacking all the crates on top of each other like 2\n1\n6\n... is also 57 bytes, and is "simpler", but I didn't want to stretch the page. :)

Update: stacking the crates into a rectangle is shorter! Who'd've thought?

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

Doorspace, 92 bytes

The language is also known as Qugord.

~group h from %2 to %14 affect h into "Hello, World!" each h into 0 task give 0 to 1 publish

or

~group h from 0 to %12 affect h into "Hello, World!" each h into 0 task give 0 to %0 publish

It's seriously bugging me that this has a horizontal scrollbar because of a single character. I don't see how to shorten it any further though.

This solution is mostly a golfed version of the "Hello, World!" example on the esolangs page. The important concepts of the language are that it operates on an infinite main array, initialised to zeroes; and then there's also an output array, which is reset every time you print its contents. If you know what the commands mean, the code is actually quite readable if split across several lines (which is not valid in the language):

group h from %2 to %14 
affect h into "Hello, World!" 
each h into 0 task 
  give 0 to 1 
  publish

The first line defines a "group tag" h, which is some subarray of the main array. In this case, it addresses the cells at indices 2 to 14 (leaving 2 cells for future use).

The second line writes the character codes of Hello, World! into these 13 cells.

The third line defines a foreach loop over the cells in h, which works by copying the current value into the specified cell (0) and then executing the code after it.

The fourth line is executed once for each character code (which we find in cell 0). It moves the character code from the 0th cell of the main array to the 0th cell of the output array (which we index relatively by looking at index 1 on the main tape, which is zero).

The fifth line prints everything in the output array up to the last non-zero element (i.e. just the first cell in our case).

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

Parenthetic, 1036 Bytes

This can undoubtedly be done better, but it's about the best I can come up with at the moment.

((()()())(()()()())((()()(()))((())()()()())((())()()()()()()()())))((()()())(()(())())((()(()))(()()()())((())()()()())))((()()())(()()(()()))((()()(()))(()()()())((())()()())))((()()())(()(()())())((()()(()))(()(())())((())()()())))((()(())()(()))((()((()))())((()(())(())())((()()(()))(()(())())((())()())))((()((()))())((()(())(())())((()(()))(()()(()()))((())()()()()())))((()((()))())((()(())(())())(()(()())()))((()((()))())((()(())(())())(()(()())()))((()((()))())((()(())(())())((()(()))(()(()())())((())()()())))((()((()))())((()(())(())())((()(()))(()()()())((())()()()()()()()()()()()())))((()((()))())((()(())(())())(()()()()))((()((()))())((()(())(())())((()(()()))(()()(()()))((())()()()()()()()()())))((()((()))())((()(())(())())((()(()))(()(()())())((())()()())))((()((()))())((()(())(())())((()(()))(()(()())())((())()()()()()())))((()((()))())((()(())(())())(()(()())()))((()((()))())((()(())(())())((()(()))(()()(()()))((())()()()())))((()((()))())((()(())(())())((()(()))(()()()())((())())))(()((())))))))))))))))))

General Steps

Define A 32
Define B 36
Define C 32 * 3
Define D 36 * 3
Build a list of chars with (A*2)(C+5)(D)(D)(D+3)(A+12)(A)(C-9)(D+3)(D+6)(D)(C+4)(A+1)
Output list + empty set as string

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

l33t, 104 bytes

7 99999998 1 7 9991 1 7 6 1 1 7 2 1 5 0 7 99997 1 8 92 1 6 0 8 995 1 7 995 1 7 2 1 8 5 1 8 7 1 5 0 7 0 1

I've been using the Ruby interpreter which seems to insert an 10 (END) at the end of the code implicitly.

l33t is supposed to look like l33t-5p34k. However, it is interpreted by simply summing the digits in each "word" and turning that into an opcode. So for golfing all we want is those digits. Golfing l33t like this is definitely living on the edge though. Quoting from the language spec:

It is possible to program in l33t just using numbers, i.e. not forming letters in l33t 5p34k. However, programmers who do this are teh sUxX0r, and the interpreter is well within its rights to format your hard drive for attempting this.

As for the language itself, it's basically a Brainfuck-derivative. The main differences are that the source code is living on the tape as well (with an independent memory and instruction pointer), and that you define an offset whenever you move forward, backward, increment or decrement (so you can make larger jumps and increment more efficiently). Therefore, the techniques used in the short Brainfuck solutions don't help much here.

I started out with the naive solution (increment/decrement to value, print, repeat). That was 105 bytes. I managed to shave off one byte by computing the symbols , ! on a different memory cell than the letters (because the offsets from o to ,, space to W and d to ! are expensive. I think I might be able to save a few more by jumping into the program memory, but I'll have to try that tomorrow.

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

Wake, 16 bytes

:"Hello, World!"

Not much room for golfing.

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

ShortScript, 2 bytes

By using the function from the standard library:

$H

And by not using it:

→Hello, World!
\$\endgroup\$
6
  • \$\begingroup\$ That library seems to be missing from your reference implementation on Esolang. \$\endgroup\$ – Dennis Sep 4 '15 at 14:17
  • \$\begingroup\$ Yes, I the current version is a bit buggy \$\endgroup\$ – YourDeathIsComing Sep 4 '15 at 16:58
  • \$\begingroup\$ I have updated the esolangs page. Now it will work. \$\endgroup\$ – YourDeathIsComing Sep 4 '15 at 17:48
  • \$\begingroup\$ That implementation doesn't seem to print the exclamation point. \$\endgroup\$ – Dennis Sep 4 '15 at 17:58
  • \$\begingroup\$ I will fix it tomorrow, when I am at PC. \$\endgroup\$ – YourDeathIsComing Sep 5 '15 at 21:02
2
\$\begingroup\$

Scheme, 24 26 25 bytes

(write "Hello, World!")

(display"Hello, World!")

simple but no one has done it in this language yet.

edit: fixed the quotes being printed.

\$\endgroup\$
5
  • \$\begingroup\$ i changed the code a little so it doesn't show the quotes \$\endgroup\$ – Buzz Aug 31 '15 at 14:20
  • \$\begingroup\$ Are the quote marks necessary in case of display? The H in Hello needs to be upper-case btw. \$\endgroup\$ – CodeManX Sep 3 '15 at 0:16
  • \$\begingroup\$ @CoDEmanX Yeah the quotes are necessary. Otherwise it thinks its a variable. \$\endgroup\$ – Buzz Sep 3 '15 at 13:30
  • \$\begingroup\$ Sure you can't get rid of the space before "? \$\endgroup\$ – Lynn Sep 4 '15 at 14:08
  • \$\begingroup\$ That space can be removed. Normally scheme needs the spaces to tell two things apart. but in this case it doesn't need it \$\endgroup\$ – Buzz Sep 4 '15 at 14:28
1
10 11
12
13 14
28

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.