520
\$\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
  • 4
    \$\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, 2015 at 13:56
  • 7
    \$\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, 2015 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, 2015 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, 2015 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, 2018 at 10:20

983 Answers 983

1
12 13
14
15 16
33
3
\$\begingroup\$

yuno (abandoned), 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\$
3
\$\begingroup\$

BrainCrash, 14 bytes.

Note that this is NOT Braincrash; this is also a Brainfuck-variant, with these expansions:

  • The first 13 cells are initially Hello, world!.
  • Automatically implicit output.
  • Four logical operators.

Here is the program:

>>>>>>^<<<<<<<

What it does

  • Move to space.
  • ^ is mem[ptr+1]=mem[ptr] xor mem[ptr+1]; ptr++;; to change w with W.
  • Go back.
  • Implicit [.>]

Try it online! The interpreter was originally written by "ぬこ", the designer of the language; I modified a bit for TIO.

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

brainbox, 118 bytes

 ++++<!.+aa.--------.------.+++.d.-d.------------.++++++++++++aa.+++..+++++++.---w.dd]-sa-a+w+d]-ds+a+++a+++w++d[++++d

Try it Online!

I've finished my new language, called brainbox! It's a 2D extension of brainfuck, with a 2D grid for the code and a 2D grid for the memory. This program is a modification of the "Hello World!" program in brainfuck found on esolangs.org. I used a few features to shorten it:

  • Instead of using ++++++++ to set the first cell to 8, I used ++++<, which is 3 bytes shorter and changes the IP direction to the left.

  • I made use of the 2D memory space in order to reduce the number of commands needed to move the memory pointer around.

  • I also used an unmatched ] to loop execution back to (0,0). This doesn't actually save any bytes here, but I wanted to show off that feature.

For more information on the language and some of the features and quirks, check out the GitHub repo.

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

GForth 17 Bytes

." Hello, World!"
\$\endgroup\$
2
  • 1
    \$\begingroup\$ @Razetime Consensus is irrelevant since it works in the specific implementation. \$\endgroup\$
    – Bubbler
    Jul 26, 2021 at 8:20
  • \$\begingroup\$ @Razetime I would not call that a consensus. If there is a disagreement it would be better to take this to the meta, than to discuss in comments. \$\endgroup\$
    – Wheat Wizard
    Jul 26, 2021 at 8:22
3
\$\begingroup\$

abcn, 92 bytes

aaaac018gxnaaaaac020agxaaaaaaagxgxaaagxnaaaac008gxbbc004bgxbbbbbbbbgxaaagxbbbbbbgxbbbbbbbbgx

Obviously not the shortest answer by a mile but for me its fine.

Now how does this work

aaaac018gxn  H --> 72
aaaaac020agx E --> 101
aaaaaaagx    L --> 108
gx           L --> 108 
aaagxn       O --> 111
aaaac008gx   SPACE ---> 32
bbc004bgx    W  --> 119
bbbbbbbbgx   O  --> 111
aaagx        R  --> 114
bbbbbbgx     L  --> 108
bbbbbbbbgx   D  --> 100

For reference a inc accumulator by 1, b decs by 1 and c is for multiplication g converts to ASCII and x prints

(I do have an interpreter, clicking the link leads to it but you are gonna have to test it yourself)

NOTE : language is WIP

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

Paradoc, 15 bytes

first paradoc solution lol

"Hello, World!"

Try it online!

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

Jealous, 14 bytes

ᐗHello, World!
\$\endgroup\$
3
\$\begingroup\$

Noxan, 16 bytes

¶"Hello, World!

Noxan, 15 bytes

"Hello, World!"

Noxan, 14 bytes

"Hello, World!

Noxan, 2 bytes

¶g

Noxan, 1 bytes

g

New language!

\$\endgroup\$
3
  • \$\begingroup\$ No implicit output? Also, Noxan! \$\endgroup\$
    – lyxal
    Feb 26, 2022 at 12:16
  • \$\begingroup\$ @lyxal I'll update this when I add implicit output. \$\endgroup\$ Feb 26, 2022 at 13:13
  • \$\begingroup\$ Also, maybe add an alternative solution below with g \$\endgroup\$
    – math scat
    Feb 26, 2022 at 14:57
3
\$\begingroup\$

Exceptionally, 17 bytes

P"Hello, World!"/

Attempt This Online!

Explanation

P "Hello, World!"  ' Print that string
/                  ' Divide the register (initially 0) by itself to exit the program
\$\endgroup\$
3
\$\begingroup\$

SPDT, 756 bytes

p 0
r 0 0 1 2
r 1 0 2 3
r 4 0 2 3
r 3 0 2 5
r 5 0 2 6
r 6 0 2 7
r 7 0 2 8
r 8 0 2 9
r 9 0 2 10
r 10 0 2 11
r 11 0 2 12
r 12 0 2 13
r 13 0 2 14
r 14 0 2 15
r 15 0 2 4
r 5 0 2 16
r 8 0 2 16
r 11 0 2 16
r 12 0 2 16
r 4 0 2 16
r 8 0 2 17
r 11 0 2 17
r 12 0 2 17
r 13 0 2 17
r 5 0 2 18
r 6 0 2 18
r 7 0 2 18
r 8 0 2 18
r 9 0 2 18
r 11 0 2 18
r 12 0 2 18
r 14 0 2 18
r 15 0 2 18
r 3 0 2 19
r 6 0 2 19
r 7 0 2 19
r 8 0 2 19
r 9 0 2 19
r 12 0 2 19
r 14 0 2 19
r 11 0 2 20
r 13 0 2 20
r 5 0 2 21
r 6 0 2 21
r 7 0 2 21
r 8 0 2 21
r 9 0 2 21
r 10 0 2 21
r 12 0 2 21
r 13 0 2 21
r 14 0 2 21
r 15 0 2 21
r 4 0 2 21
r 3 0 2 22
r 5 0 2 22
r 6 0 2 22
r 7 0 2 22
r 8 0 2 22
r 11 0 2 22
r 12 0 2 22
r 13 0 2 22
r 14 0 2 22
r 15 0 2 22
l 23
l 22
l 21
l 20
l 19
l 18
l 17
l 16

Try it: https://radvylfprograms.com/spdt


SPDT is an esolang I've been wanting to make for a while now. Aside from I/O, it consists entirely of Single Pole Double Throw, or Form C, relays. This answer, which is possibly imperfectly golfed since I used a custom transpiler with macros to generate it, consists of relays forming a loop counting from 1 to 13, then back 1, infinitely. For each of these states, it uses relays to only light up the bits which are on in that character of Hello, World!, producing the following output:

An animated GIF, showing 13 frames, with each consisting of 8 boxes representing bits, which represent the characters in "Hello, World!"

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

ABC, 21 bytes

WRITE "Hello, World!"

Try it online!

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

CATHY, 175 bytes

catHYcAthycAthYcAthYcaTHycathycAthYcAthYcAthycatHycaTHycaThYcaTHycathYcatHycatHYcaTHycaTHYcAthycathYcatHycatHYcatHycatHYcatHYcatHYcatHYCatHycathYcathYcaThYCAthyCATHycATHycAtHy

Try it Online! -90 thanks to Steffan.

CATHY is a joke language based on a certain spam post. In normal form:

389960998265612367812323333;115τCƒ+

It pushes a huge integer, then converts to base 115 and charcodifies.

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

Verbosity v2, 87 bytes

For some reasons, at least in the TIO's implementation it doesn't require the import statements...

outpt=OutputSystem:NewOutput<DEFAULT>
OutputSystem:DisplayAsText<outpt;"Hello, World!">

Try it Online!

Note: the name outpt is because variables name must be at least 5 characters long.

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

Stack Cats, 94 + 3 = 97 bytes

(^_^_[>_[_*:>^]<^[>+:^[_!:+_+:>-!^_!]<:_^_I_+>_]<:_I_+:>_I^+>_I_+*-!*>+![+]+_!_-^+_)*_:_-^_!_:

Needs to be run with the -m switch, so +3

Try it online!

I'm sure there're still a lot of bytes which can be golfed, but this is the best I could think of so far.

Due to the reversibility of Stack Cats, I found it easier to think about the code in reverse - instead of thinking about how to turn the empty string into "Hello, World!", we want to think about how to consume the string "Hello, World!" from the stack.

I won't explain in detail what the code does, but it doesn't use any complicated tricks, and you can get a good idea by running it with the -D flag on the string "Hello, World!", or by pasting the code in the parenthesis in this site I made to help me create it, and typing slowrun() in the console. I found the code to create 100 33 8 by going over all programs under length 12, running them on 0 0 -1, and calculating the result's distance to 100 33 8 with BFS, and also used BFS to find what numbers can be converted to others with short code (for example converting 72 to 8 with 101, or converting 87 to -8 using 111).

\$\endgroup\$
1
  • \$\begingroup\$ You don't have to count flags anymore, so just 94 \$\endgroup\$
    – emanresu A
    Nov 10, 2022 at 22:06
3
\$\begingroup\$

x86/x86_64 on Linux, 34 32 31 bytes

00:      e8 0d 00 00 00          call   <+0x12>
05:      48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21
                                 "Hello, World!"
12:      59                      pop    %ecx
13:      6a 01                   push   $0x1
15:      5b                      pop    %ebx
16:      6a 0d                   push   $0xd
18:      5a                      pop    %edx
19:      6a 04                   push   $0x4
1b:      58                      pop    %eax
1c:      cd 80                   int    $0x80
1e:      c3                      ret

Main differences between this one and grc's version: mine makes no assumption of prior register contents, works in both x86 and x86_64 modes and does a ret in lieu of a sys_exit() syscall.

If you want to Try it online!, compile and run the following C program.

const char main[]="\xe8\r\0\0\0Hello, World!Yj\1[j\rZj\4X\xcd\x80\xc3";

Note that Windows Services for Linux currently doesn't seem to support this type of syscall.

EDIT: Fixed TIO link.

\$\endgroup\$
4
  • \$\begingroup\$ The difference is that yours is a function, @grc's is code that only works from _start in a static executable (where Linux does give you zeroed registers), and runs sys_exit when it's done. (And BTW, this won't work in 64-bit PIE executables (so your sample caller fails on many recent Linux distros where gcc -pie is the default, or any other context where the code is outside the low 32 bits. int 0x80 truncates pointers to 32 bits) \$\endgroup\$ Apr 13, 2018 at 4:31
  • \$\begingroup\$ If you make position-dependent code, you could use mov $msg, %ecx (5 bytes) instead of call/pop. Put msg after the ret in your function. You can also save instructions (but not code size) by using lea 3(%ebx), %eax (3 bytes) instead of push/pop, after getting a known value of ebx=1. (Still portable between ia32 and x86-64 with the same machine code, because lea 3(%rbx),%eax is safe. Tips for golfing in x86/x64 machine code). Other than position-dependent mov r32, imm32, I don't see a way to make this shorter. \$\endgroup\$ Apr 13, 2018 at 4:36
  • \$\begingroup\$ Here's a 30-byte version godbolt.org/g/xAcGMg (position-dependent, and avoiding push/pop in favour of xor-zero/inc and LEA). Note that as a function, it clobbers EBX, thus violating the standard calling convention. That's fine for asm functions, though, but maybe something to mention when you're showing how to use it as a C main. The CRT code that calls main doesn't actually break if main clobbers EBX on my system, last I checked, but it could. \$\endgroup\$ Apr 13, 2018 at 4:46
  • \$\begingroup\$ *window subsystem for linux \$\endgroup\$
    – ASCII-only
    Apr 17, 2018 at 11:10
3
\$\begingroup\$

Aheui (esotope), 92 bytes

붊볼벎봆뱞벽뱖벽브벓벍
부볃붊벋볾뱛벋따드먛뗘벎희별
밤뵗뵏뵒볾

Try it online!

Same code as below, but reuses four "data" chars (12 bytes) at the expense of two newlines. The compound vowel ㅚ does not have an assigned momentum, so the IP keeps going with the same speed and direction.


Aheui (esotope), 117 102 bytes

밞바밤밣받밞밞밞밦밞바밝밣바박박밦밞받밞받밞발밣받뱔희밞땨몋드떠받볋

Try it online!

Another approach that is simpler and actually achieves the 2-char-per-output encoding. Each byte in Hello, World! can be encoded as \$9x+y+24\$ where \$x, y \in \{0,2,3,4,5,6,7,8,9\}\$. Here is the encoder. It also happened that the two additions were neatly merged into one character (once with +2 step and the other with -1), shaving off another char.


Aheui (esotope), 117 bytes

박밤밝발밞받밝밝밦밞밦발받박타받발따발밯밦밞밞받밞받밤받발따밞뱧희밣댜몋땨뎌벎

Try it online!

Aheui (esotope), 123 bytes

박박발타밝받발밞밝발밣받밣바받받밣타받밯밣받발밞발밞밦발밝뱧희밣댜몋땨뎌뱔텨뱔벽떠

Try it online!

Previous record: 144 by Sait2000

Since Aheui cannot push 10 or higher number at once, these programs try to minimize the cost of data by encoding each character into two numbers on the stack. If we subtract each character's charcode by 9 (the magic number), we get

63 92 99 99 102 35 23 78 102 105 99 91 24
7x9, 23x4, 11x9, 11x9, 17x6, 7x5, 23x1, 13x6, 17x6, 15x7, 11x9, 13x7, 12x2

And then subtract 8 from the larger number of each pair to get

-1 9 15 4 3 9 3 9 9 6 -1 5 15 1 5 6 9 6 7 7 3 9 5 7 4 2

Each occurrence of 15 or 1 adds 3 commands; the rest can be pushed in one. Then the loop is essentially

loop {
  add 8 (if stack is empty, halt)
  mul
  add 9; print as char
}

The second program is written in the same way, but using 23 as the magic number instead.

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

Trilangle, 42 bytes

Prints no trailing newline.

"Hoo"!"o(oeooolo"""o"",Wr"!.looodo..o"""o@

Try it in the online interpreter: https://bbrk24.github.io/Trilangle/
The default program in the online interpreter is a variation on this that does print the trailing newline.

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

Logically, 1046 Bytes

@A:3i:o,c:4t;XOR(3i)(t3)AND(i0,i1)(t0)AND(i1,i2)(t1)AND(i0,i2)(t2)COPY(t3)(o)OR(3t)(c)
@B:8a,8b:8o,d:7c;A(a0,b0,0)(o0,c0)A(a1,b1,c0)(o1,c1)A(a2,b2,c1)(o2,c2)A(a3,b3,c2)(o3,c3)A(a4,b4,c3)(o4,c4)A(a5,b5,c4)(o5,c5)A(a6,b6,c5)(o6,c6)A(a7,b7,c6)(o7,d)
@C:i,a,b:d:x,y,z;NOT(i)(x)AND(a,x)(y)AND(b,i)(z)OR(y,z)(d)
@D:i,8a,8b:8o;C(i,a0,b0)(o0)C(i,a1,b1)(o1)C(i,a2,b2)(o2)C(i,a3,b3)(o3)C(i,a4,b4)(o4)C(i,a5,b5)(o5)C(i,a6,b6)(o6)C(i,a7,b7)(o7)
@E:1i,i,16a,16b:8o:8c,8d;D(1i,16a)(8c)D(1i,16b)(8d)D(i,8c,8d)(8o)
@F:2i,i,32a,32b:8o:8c,8d;E(2i,32a)(8c)E(2i,32b)(8d)D(i,8c,8d)(8o)
@G:3i,i,64a,64b:8o:8c,8d;F(3i,64a)(8c)F(3i,64b)(8d)D(i,8c,8d)(8o)
@H:i:p:b_HIGH;NOT(i)(b)AND(i,b)(p)
@I:i:o:16d;COPY(i,16d)(16d,o)
@J B:8a,8i,b,r,d,8c;B(8a,1)(8i)CELL(b,8i)(8a)H(H)(r)OR(r,b)(d)I(d)(b)WRITE(b,8c)()G(4a,0,0,0,1,0,0,1,0,1,0,1,0,0,1,1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,1,1,1,1,0,1,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1,0,1,1,1,1,0,1,1,0,0,1,0,0,1,1,1,0,0,0,1,1,0,1,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1)(8c)HALT(c7)()

Ungolfed

@2BitAdder
: 3in;
: out, carry;
: 4t;
XOR  (3in)           (t3)
AND  (in0, in1)      (t0)
AND  (in1, in2)      (t1)
AND  (in0, in2)      (t2)
COPY (t3)            (out)
OR   (3t)            (carry)

@ByteAdder
: 8a, 8b;
: 8o, carry;
: 7c;
2BitAdder (a0, b0, 0)  (o0, c0)
2BitAdder (a1, b1, c0) (o1, c1)
2BitAdder (a2, b2, c1) (o2, c2)
2BitAdder (a3, b3, c2) (o3, c3)
2BitAdder (a4, b4, c3) (o4, c4)
2BitAdder (a5, b5, c4) (o5, c5)
2BitAdder (a6, b6, c5) (o6, c6)
2BitAdder (a7, b7, c6) (o7, carry)

@Mux
: i, a, b;
: d;
: ni, ani, bi;
NOT (i)       (ni)
AND (a, ni)   (ani)
AND (b, i)    (bi)
OR  (ani, bi) (d)

@ByteMux
: i, [8d0], [8d1];
: [8o];
Mux (i, d00, d10) (o0)
Mux (i, d01, d11) (o1)
Mux (i, d02, d12) (o2)
Mux (i, d03, d13) (o3)
Mux (i, d04, d14) (o4)
Mux (i, d05, d15) (o5)
Mux (i, d06, d16) (o6)
Mux (i, d07, d17) (o7)

@4ByteMux
: 1i, i, 16a, 16b;
: 8o;
: 8c, 8d;
ByteMux (1i, 16a)    (8c)
ByteMux (1i, 16b)    (8d)
ByteMux ( i, 8c, 8d) (8o)

@8ByteMux
: 2i, i, 32a, 32b;
: 8o;
: 8c, 8d;
4ByteMux (2i, 32a)     (8c)
4ByteMux (2i, 32b)     (8d)
ByteMux  ( i, 8c,  8d) (8o)

@FByteMux
: 3i, i, 64a, 64b;
: 8o;
: 8c, 8d;
8ByteMux (3i, 64a)    (8c)
8ByteMux (3i, 64b)    (8d)
ByteMux  ( i, 8c, 8d) (8o)

@RisingEdge
: in;
: pulse;
: bar_HIGH;
NOT (in)      (bar)
AND (in, bar) (pulse)

@Delay
: in;
: out;
: 16d;
COPY (in, 16d) (16d, out)

@Main
Bus: 8a, 8i, clock, risingPulse, delayIn, 8c;
ByteAdder       (8a, 1) (8i)
CELL            (clock, 8i)             (8a)
RisingEdge      (H)                     (risingPulse)
OR              (risingPulse, clock)    (delayIn)
Delay           (delayIn)               (clock)
WRITE           (clock, [8c])           ()
FByteMux        (4a,
                0,0,0,1, 0,0,1,0,
                1,0,1,0, 0,1,1,0,
                0,0,1,1, 0,1,1,0,
                0,0,1,1, 0,1,1,0,
                1,1,1,1, 0,1,1,0,
                0,0,1,1, 0,1,0,0,
                0,0,0,0, 0,1,0,0,
                1,1,1,0, 1,0,1,0,
                1,1,1,1, 0,1,1,0,
                0,1,0,0, 1,1,1,0,
                0,0,1,1, 0,1,1,0,
                0,0,1,0, 0,1,1,0,
                1,0,0,0, 0,1,0,0,
                0,1,0,1, 0,0,0,0,
                0,0,0,0, 0,0,0,1)
                                        (8c)
HALT            (c7)                    ()

Uses a Clock circuit to count up and output each character manually from a 16 byte Demuxer

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

Befalse (quirkster), 22 bytes

"!dlroW ,olleH"::::..;

Try it! (Usage: copy-paste into the code box, click Show above it, and then Run.)

So this is the golfiest way to repeat a single command a finite number of times and halt in Befalse.

: (Call) pushes the position to return onto the return stack so that ; (Ret) can return to the instruction after the corresponding :. As in Modular SNUSP, the return position is two steps away from the position of :. When the return stack is empty at ;, the program ends.

::::..; happens to execute . exactly 13 times:

::::..;
ABCDEF
starting at E, `.` is run twice
starting at D, `.` is run 3 times (EF, then return to F)
starting at C, `.` is run 5 times (DEF, then return to E)
starting at B, `.` is run 8 times (CDEF, then return to D)
starting at A, `.` is run 13 times
\$\endgroup\$
3
\$\begingroup\$

AWK, 18 bytes

$0="Hello, World!"

Try it online!

AWK defaults to {print $0}. Pass/pipe this anything and it will just print "Hello, World!".

echo "" | awk '$0="Hello, World!"'
New contributor
C K is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$
3
\$\begingroup\$

Lazy K, 555 bytes

k(s``si`k``s``sss``s``ss``ss0``ss0``s``si`k``ss``s``ss0``ss(ss`ss``ss0)(s`0001ki
`s``si`k``s``si(ssi``ss0)(ssi``ss``ss0)``s``si`k``ss``s``sss``ss(ss`ss``ss0)``s`
`si`k``ss``ss``s``sss``s``sss``ss0``s``si`k``s``ss(ssi``ss0)``ss0``s``si`k``s``s
i``ss``ss0``ss``ss(ssi``ss``ss0)``s``si`k``ss``s``sss``ss(ss`ss``ss0)``s``si`k``
s``si``ss0``ss``s``sss``ss``s``sss``ss0``s``si`k``s``si(ssi``ss0)(ssi``ss``ss0)`
`s``si`k``s``ss0``ss(ss`ss``ss0)``s``si`k``ss``s``ss(ssi``ss0)``ss0``s`k(si`s`k`
si``sii)``si`k(ssi(ssi``ss0)))``s`0001`001`0001``s`k`si`001``si`k`0001k`kk)
\$\endgroup\$
2
\$\begingroup\$

Algoid, 28 bytes

text.output("Hello, World!")

Now that's just boring in such a fun language... Here's a slightly longer version, let's get some colours going for 104 bytes:

algo.hide()
algo.setColor(algo.color.GREEN)
algo.setBgColor(algo.color.DARK_RED)
algo.text("Hello, World!")

See the output here

Okay I've finished for the day now :)

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

Io, 21 bytes

"Hello, World!" write
\$\endgroup\$
2
  • \$\begingroup\$ This Io (TIO) seems to have print, but not write. Is this another language with the same name? \$\endgroup\$
    – Dennis
    Feb 11, 2018 at 15:40
  • \$\begingroup\$ @Dennis It appears to have write, but it appears to write to some mysterious location/file/somewhere else instead of STDOUT \$\endgroup\$
    – ASCII-only
    Apr 13, 2018 at 8:35
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, 2015 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, 2015 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\$ Jun 2, 2016 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\$ Jul 19, 2016 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\$ Mar 19, 2017 at 8:53
  • 1
    \$\begingroup\$ If the one-blank-input rule is allowed, this works too $0="Hello World!" \$\endgroup\$
    – cnamejj
    Apr 14, 2021 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\$

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, 2018 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
1
12 13
14
15 16
33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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