517
\$\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, 2015 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, 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

974 Answers 974

1
18 19
20
21 22
33
2
\$\begingroup\$

Etch, 20 bytes

New language! :D

:out"Hello, World!";

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

Fennel, 22 bytes

(print"Hello, World!")

¯1 byte thanks to @ovs

\$\endgroup\$
2
  • \$\begingroup\$ I think you can omit the space. At least that works with the REPL on the website \$\endgroup\$
    – ovs
    Mar 30, 2022 at 7:35
  • \$\begingroup\$ @ovs yep that works \$\endgroup\$
    – zoomlogo
    Mar 30, 2022 at 8:11
2
\$\begingroup\$

Makina, 19 bytes

New language! :D

P
>t:Hello, World!;
\$\endgroup\$
2
\$\begingroup\$

EEL - 86 Bytes

=72 !>=101 !>=108 !>=108 !>=111 !>=44 !>=32 !>=87 !>=111 !>=114 !>=108 !>=100 !>=33 !.

Explanation

EEL (Easy Esoteric Lang) is an esoteric programming language created by me, easy to manage, hence the name. Below is a brief description of the language.

.-EEL is based on a vector of bytes initialized to zero, on which basic arithmetic operations can be performed, whose length is equal to 64Kb.

.-EEL allows the reading and writing of one byte at a time in the form of an ASCII character in the standard input and output respectively.

.-EEL has a brief help section which can be viewed from the interpreter.

.-EEL is extremely sensitive, so a wrong input byte can cause a wrong output.

.-EEL does not have an error/exception handling system, so it may crash unexpectedly if a fatal error such as division by zero occurs.

Defined operations:

=000 -> Copy the value of number 000 to the current byte.

+000 -> Add to the current byte, the value of number 000.

-000 -> Subtract to the current byte, the value of number 000.

*000 -> Multiply to the current byte, the value of number 000.

/000 -> Divide to the current byte, the value of number 000 (cannot be zero).

%000 -> Calculate the modulo of the current byte and the value of number 000 (cannot be zero).

> -> Go to the next byte of the vector.

< -> Go to the previous byte of the vector.

? -> Read a ASCII character from STDIN and assign it to current byte.

! -> Write to current byte in STDOUT as an ASCII character.

: -> Open/close the space for comments.

. -> Exit the program.

$ -> Reference to current byte.

NOTES:

The 000 number can be s current byte reference operator ($).

The 000 number (x) must be an integer number, such 0 < x <= 255.

There must be a space character u+0020 after each number 000.

Try the EEL interpreter!

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

MSWLogo, 16 bytes

pr[Hello, World!

Picture to prove it works

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

A very long language name that is very weird and yeah, this is your but its this, 80 bytes.

A very long language name that is very weird and yeah, this is your but its this
\$\endgroup\$
2
\$\begingroup\$

A Language Programmed While Listening to Godspeed You! Black Emperor, 93 bytes

charms 72. 101. 108. 108. 111. 44. 32. 119. 111. 114. 108. 100. 33. 10﹔
print﹔
give up﹔

This is an esolang, and the goal of the language was to make it as annoying as possible to program.

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

Perhaps --verbose, 14 bytes

"Hello, World!
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Perhaps this will be the first of many Perhaps answers. :p \$\endgroup\$
    – lyxal
    Jun 25, 2022 at 9:15
  • \$\begingroup\$ \$\endgroup\$ Jun 25, 2022 at 9:17
2
\$\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
2
\$\begingroup\$

Knight, 16 bytes

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

Cognate, 20 bytes

Print"Hello, World!"

Attempt This Online!

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

Gaia, 14 bytes

“Hello, World!

Try it online!

Strange that there wasn't a Gaia answer to this challenge yet, given that there's so many answers.

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

Functional(), 139 129 bytes

0,1,=,:(W,& a(>(a(:(Z,&()(W()0)))),W))0 Z Z()1()1 W()W()>()W()>()> >()>()W()1()0()0()Z W 1()1()1()> >()> Z W 1()W()>()Z W()1()0 Z

Try it online!
Try the 139B version online!

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

HP User RPL, 14 bytes

Thanks Corvalis

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

Rol, 24 bytes

println("Hello, World!")

Rol is a new language I'm creating for the purposes of replacing Lua (because who likes Lua). I was gonna post this when the language was much more mature but I felt like reworking the CLI so I added an interpreter mode. That means you don't have to mess around with the stdlib and Lua linking and whatnot.

Once you download the jar from the releases, run it like this:

java -jar Rol-<version>.jar -i <input file>

Make sure -i is added otherwise it'll spit out a compiled Lua file.

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

GAIA, 14 bytes

“Hello, World!

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You need an ! at the end. Also, it seems to work without the trailing quote. \$\endgroup\$
    – The Thonnu
    Apr 18, 2023 at 15:22
2
\$\begingroup\$

Axo, 29 bytes

"!dlroW ,o%
\%#[<"Hell<
 >( ^

Please let me know if this can be golfed further.

\$\endgroup\$
4
  • \$\begingroup\$ Another 29 byte solution: "!dlroW ,olleH"(((((((((((((\ \$\endgroup\$
    – MilkyWay90
    Feb 6, 2019 at 3:42
  • 1
    \$\begingroup\$ You may want to consider putting in a TIO link to make it more accessible for others to test it \$\endgroup\$
    – MilkyWay90
    Apr 21, 2019 at 22:50
  • 1
    \$\begingroup\$ On the first line, the comma should be after the space, as currently this outputs "Hello ,World!" rather than "Hello, World!" \$\endgroup\$
    – noodle man
    Apr 13, 2023 at 16:24
  • 1
    \$\begingroup\$ @Jacob Good catch, thank you! \$\endgroup\$ Apr 20, 2023 at 3:43
2
\$\begingroup\$

hyperscript, 27 24 bytes

init log 'Hello, World!'

<script src="https://unpkg.com/[email protected]"></script>
<script type="text/hyperscript">

init log 'Hello, World!'

</script>

Calls the log command when the document is initialized.

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

Java, 47 bytes

void main(){System.out.print("Hello, World!");}

This uses JEP 445: Unnamed Classes and Instance Main Methods which is released in Java 21 as a preview.

With the preview JDK, run like this:

java --source 21 --enable-preview Main.java
\$\endgroup\$
2
\$\begingroup\$

Thunno 2, 2 bytes

kH

Attempt This Online!

Polyglots with Vyxal. Constant for "Hello, World!".

Thunno 2, 8 bytes

’Ƙ¥, «ʋ!

Attempt This Online!

Dictionary compressed string.

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

Vyxal, 10 bitsv1, 1.25 bytes

kH

Try it Online!

Pushes the string "Hello, World!"

Alternatively,

Vyxal, 50 bitsv1, 6.25 bytes

`ƈṡ, ƛ€!

Try it Online!

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

Commodore C64 BASIC (Non-competing/just for fun), 36 Tokenised BASIC bytes, 34 PETSCII characters

0LIST:REM"{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}HELLO, WORLD!

This uses a trick to hide a BASIC line, by starting a REM statement with a quotation mark, you may use the delete control character (CTRL+T) which is displayed as a reversed T character (see screen shot below). When you RUN the program, the line number, LIST and REM command are hidden by the text HELLO, WORLD!. You get the same output when you LIST the program too.

Hello, World! on the Commodore C64, but the long way around.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Wait, this is worse than the standard 0?"Hello, world!, codegolf-wise, right? \$\endgroup\$
    – Maya
    Dec 11, 2023 at 0:50
  • \$\begingroup\$ Why 0?"HELLO, WORLD! when one might as well just do ?"HELLO, WORLD! without the line number? I include it not because it's the best solution, but because it is possible within BASIC V2 on a Commodore C64. Also, I clearly marked this as non-competing and just for fun - so I assume that your question is entirely rhetorical. \$\endgroup\$ Dec 11, 2023 at 8:20
2
\$\begingroup\$

Shasta v0.0.5, 24 bytes

(print["Hello, World!"])

Shasta is a new programming language I've been developing for the past couple of days, and I've finally got it to a state where I can start to answer some challenges on the site here. It is inspired by Lisp and Python, and transpiles to JavaScript. I'll update the header once the language gets a bit more stable; it's possible (though very unlikely) that this Hello World program won't work anymore in the future.

I haven't set up an online interpreter yet, so for now you can install Shasta off NPM with npm install --global [email protected], and run it via the CLI:

echo '(print["Hello, World!"])' | shasta-lang | node
Hello, World!
\$\endgroup\$
2
\$\begingroup\$

(,) 375 344 334 Chars or \$334\log_{256}(3)\approx66.17\$ Bytes

(()()(),()()()()()()())((),(()()())()()())((()),(())(())(()))(((())),((()))((()))(()))(,,,(((())))()())(()(),(((())))((()))())(,,,(()()))(,,,(()())(()()()),(),,()())(,,,(()())(()))(,,,((()))(())()()()())(,,,((()))()())(,,,(((())))(())(()()()))(,,,(()())(()))(,,,(()())(())()()())(,,,(()())(()()()))(,,,(((())))((())))(,,,((()))()()())

Can likely still be golfed a lot.
Tio

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

Alpha AXP machine language on OSF/1, 40 bytes

0x00:   d2200004    bsr a1, 0x14(zero)    # Set a1 to pointer of string
0x04:   6c6c6548    "Hello, World!\0\0\0"
0x08:   57202c6f
0x0c:   646c726f
0x10:   00000021
0x14:   43e09400    addq    zero, 0x4, v0 # Select write() syscall
0x18:   43e03410    addq    zero, 0x1, a0 # stdout
0x1c:   43e1b412    addq    zero, 0xd, a2 # string length
0x20:   00000083    call_pal    callsys   # write(1, str, len)
0x24:   6bfa8001    ret zero, (ra), 1     # return

To try this on a suitable machine or emulator, compile and run the following C program

int main[]={0xd2200004,0x6c6c6548,0x57202c6f,0x646c726f,0x21,
            0x43e09400,0x43e03410,0x43e1b412,0x83,0x6bfa8001};
\$\endgroup\$
2
\$\begingroup\$

DEC VAX machine language on UNIX v8 or 4.3BSD, 40 39 bytes

00: 00 00                                 ;entry mask
02: dd 0d                pushl $0xd       ;len of string
04: df ef 10 00 00 00    pushal $0x1a     ;addr of string
0a: dd 01                pushl $0x1       ;file descriptor=1
0c: 9a 04 50             movzbl $0x4,%r0  ;select write() syscall
0f: fb 03 ef ff ff ff ff calls $3,0x15    ;call syscall
16: 04                   ret
17: bc 50                chmk %r0         ;syscall
19: 04                   ret
1a: 48 65 6c 6c 6f 2c 20 "Hello, World"
    57 6f 72 6c 64 21

The entry mask specifies which regs are saved and other runtime characteristics of the procedure. Because of the way syscalls work on VAX, the golfiest way to make one (as far I know) is a two step procedure. I have also overlapped the end of the "call" instruction with the start of the entry mask of the syscall procedure.

In honor of the 39th anniversary of mullender.c you can try out the above code by compiling and running the following C program on an actual or emulated VAX.

char main[]={0x00,0x00,0xdd,0x0d,0xdf,0xef,0x10,0x00,0x00,0x00,0xdd,0x01
,0x9a,0x04,0x50,0xfb,0x03,0xef,0xff,0xff,0xff,0xff,0x04,0xbc,0x50,0x04,
0x48,0x65,0x6c,0x6c,0x6f,0x2c,0x20,0x57,0x6f,0x72,0x6c,0x64,0x21};
\$\endgroup\$
2
\$\begingroup\$

D, 42 bytes

Something reminded me of this challenge today, so together with a few folks on the D Discord server, we devised what might be, however cursed, the shortest D hello world.

import std;@0main()=>"Hello, World!".puts;

Firstly, for some versions now, import std imports a large part of std modules including std.stdio, which saves 6 bytes from the usual solution. Secondly, we abuse AutoFuncDeclaration and User-Defined Attributes to apply a 0 literal as a function attribute, letting us omit the return type void. And, as it turns out, the D parser does not forbid placing identifiers right after numbers, letting us combine this into @0main. This might appear to be the devil's own creation but is 3 bytes shorter than the usual void main. Lastly, by using UFCS and substituting write or writeln for puts we save further 2 bytes.

We use the arrow notation for general "golfiness" but it's exactly the same length as if we had used braces, i.e. @0main(){...}

A questionable alternative, 38 bytes

pragma(msg,"Hello, World!");@0main(){}

While the program produced by this is valid, it doesn't do anything, and "Hello, World!" is printed during compilation.

\$\endgroup\$
1
  • \$\begingroup\$ I haven't been able to reproduce this. Could you provide a link on run.dlang.io ? \$\endgroup\$
    – ceilingcat
    Feb 2 at 1:11
2
\$\begingroup\$

Uiua, 17 bytes

&p"Hello, World!"

Explanation:

&p"Hello, World!"
  "Hello, World!" # push our dear string to the stack
&p                # print with newline

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Welcome to Code Golf SE! I'm surprised nobody posted this yet \$\endgroup\$
    – noodle man
    Jan 30 at 2:01
1
\$\begingroup\$

C++, 59 bytes

#include <iostream>
int main(){std::cout<<"Hello, World!";}
\$\endgroup\$
6
  • \$\begingroup\$ Isn't the newline optional? \$\endgroup\$
    – jrich
    Aug 28, 2015 at 14:14
  • \$\begingroup\$ @UndefinedFunction try it. It will not work without a new line \$\endgroup\$
    – galexite
    Aug 28, 2015 at 17:36
  • 2
    \$\begingroup\$ Isn't printf smaller? #include <cstdio>? \$\endgroup\$
    – galexite
    Aug 28, 2015 at 17:37
  • 1
    \$\begingroup\$ @georgeunix My comment referred to a previous version, in which it read cout<<"Hello, World!\n". The \n was removed, since a newline was not required after the output. \$\endgroup\$
    – jrich
    Aug 28, 2015 at 17:39
  • \$\begingroup\$ Oh OK, sorry for that @UndefinedFunction \$\endgroup\$
    – galexite
    Aug 28, 2015 at 17:39
1
\$\begingroup\$

Stackstack, 20 Bytes

This is a stack-based language not focused on golfing! Looks similar to Forth, and was made two years ago.

"Hello, World!"print
\$\endgroup\$
1
18 19
20
21 22
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.