498
\$\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

913 Answers 913

1
4 5
6
7 8
31
6
\$\begingroup\$

Cubically, 48 46 bytes

The previous best answer seems to have been 78 bytes long. I consider this a victory.

+35@⊕5@⊕1L@@|4U@-53@-0@R+43@+4@B'⊕3@-0@F-0@:5@

Found via computer search within a restricted subset of Cubically. Corresponding Most efficient cubifier answer by me.

Try it online!

\$\endgroup\$
6
\$\begingroup\$

Integral, 13 bytes

÷Hello, W╗ld!

Try it!

Sadly, Integral cannot yet compress capital letters, so it could not do much compression.

÷ means start compressed string.

Ignoring punctuation and capitalization yields

Integral, 9 bytes

÷▓llo═╗ld

Try it!

See also: Showcase

\$\endgroup\$
13
  • 1
    \$\begingroup\$ Can you put Integral on GitHub? \$\endgroup\$
    – user96495
    Aug 3, 2020 at 0:38
  • \$\begingroup\$ Also, how do loops work? I tried using e but it froze the interpreter. \$\endgroup\$
    – lyxal
    Aug 3, 2020 at 0:38
  • \$\begingroup\$ @Lyxal You would push the string to eval, then push the number of times to loop. Example: ⌡[Code to eval]⌡;[Encoded number of times];e \$\endgroup\$
    – nph
    Aug 3, 2020 at 12:59
  • 1
    \$\begingroup\$ @petStorm GitHub repository. For some reason the code is not working. For now keep using the old interpreter. \$\endgroup\$
    – nph
    Aug 3, 2020 at 13:19
  • 1
    \$\begingroup\$ Anyway, I created a GitHub pages online interpreter. \$\endgroup\$
    – user96495
    Aug 3, 2020 at 13:53
6
\$\begingroup\$

vJASS (Warcraft 3), 78 58 bytes

Using //! import zinc "<code_path>" command to exclude //! zinc and //! endzinc.

library a{function onInit(){BJDebugMsg("Hello, World!");}}

Explanation:

  • BJDebugMsg() prints the text on your in-game screen.
\$\endgroup\$
6
\$\begingroup\$

Windows Portable Executable 32 bit, 268 bytes

xxd:

00000000: 4d5a 0000 5045 0000 4c01 0100 0000 0000  MZ..PE..L.......
00000010: 0000 0000 0000 0000 7000 0301 0b01 0000  ........p.......
00000020: 0000 0000 0000 0000 0000 0000 b400 0000  ................
00000030: 0000 0000 0000 0000 0000 4000 0400 0000  ..........@.....
00000040: 0400 0000 0000 0000 0000 0000 0400 0000  ................
00000050: 0000 0000 0004 0000 0100 0000 0000 0000  ................
00000060: 0300 0000 0000 0000 0000 0000 0000 0000  ................
00000070: 0000 0000 0000 0000 0200 0000 0000 0000  ................
00000080: 0000 0000 e600 0000 0000 0000 2e74 6578  .............tex
00000090: 7400 0000 4600 0000 b400 0000 4600 0000  t...F.......F...
000000a0: b400 0000 0000 0000 0000 0000 0000 0000  ................
000000b0: 0000 0000 68c5 0040 00ff 15da 0040 00ff  ....h..@.....@..
000000c0: 15de 0040 0048 656c 6c6f 2c20 576f 726c  ...@.Hello, Worl
000000d0: 6421 0063 7274 646c 6c00 bb01 0080 6701  d!.crtdll.....g.
000000e0: 0080 0000 0000 0000 0000 0000 0000 0000  ................
000000f0: 0000 d300 0000 da00 0000 0000 0000 0000  ................
00000100: 0000 0000 0000 0000 0000 0000            ............

source:

; nasm

BITS 32
base equ 0x400000

;
; DOS header
;
; The only two fields that matter are e_magic and e_lfanew

mzhdr:
    dw "MZ"       ; DOS e_magic
    dw 0

;
; NT headers
;

    dd "PE"       ; PE signature

;
; NT file header
;

filehdr:
    dw 0x014C            ; Machine (Intel 386)
    dw 1                 ; NumberOfSections
    dd 0                 ; TimeDateStamp UNUSED
    dd 0                 ; PointerToSymbolTable UNUSED
    dd 0                 ; NumberOfSymbols UNUSED
    dw opthdrsize        ; SizeOfOptionalHeader
    dw 0x103             ; Characteristics

;
; NT optional header
;

opthdr:
    dw 0x10B                    ; Magic (PE32)
    db 0                        ; MajorLinkerVersion UNUSED
    db 0                        ; MinorLinkerVersion UNUSED
    dd 0                        ; SizeOfCode UNUSED
    dd 0                        ; SizeOfInitializedData UNUSED
    dd 0                        ; SizeOfUninitializedData UNUSED
    dd start                    ; AddressOfEntryPoint
    dd 0                        ; BaseOfCode UNUSED
    dd 0                        ; BaseOfData UNUSED
    dd base                     ; ImageBase
    dd 4        ; DOS e_lfanew  ; SectionAlignment
    dd 4                        ; FileAlignment
    dw 0                        ; MajorOperatingSystemVersion UNUSED
    dw 0                        ; MinorOperatingSystemVersion UNUSED
    dw 0                        ; MajorImageVersion UNUSED
    dw 0                        ; MinorImageVersion UNUSED
    dw 4                        ; MajorSubsystemVersion
    dw 0                        ; MinorSubsystemVersion UNUSED
    dd 0                        ; Win32VersionValue UNUSED
    dd 1024                     ; SizeOfImage
    dd 1                        ; SizeOfHeaders          nonzero for Windows XP
    dd 0                        ; CheckSum UNUSED
    dw 3                        ; Subsystem (Console)
    dw 0                        ; DllCharacteristics UNUSED
    dd 0                        ; SizeOfStackReserve
    dd 0                        ; SizeOfStackCommit
    dd 0                        ; SizeOfHeapReserve
    dd 0                        ; SizeOfHeapCommit UNUSED
    dd 0                        ; LoaderFlags UNUSED
    dd 2                        ; NumberOfRvaAndSizes    for Windows 10; UNUSED in Windows XP

;
; Data directories (part of optional header)
;
    dd 0, 0                     ; Export Table UNUSED
    dd idata, 0                 ; Import Table

opthdrsize equ $ - opthdr

;
; Code section header
;

    db ".text", 0, 0, 0         ; Name
    dd codesize                 ; VirtualSize
    dd code                     ; VirtualAddress
    dd codesize                 ; SizeOfRawData
    dd code                     ; PointerToRawData
    dd 0                        ; PointerToRelocations UNUSED
    dd 0                        ; PointerToLinenumbers UNUSED
    dw 0                        ; NumberOfRelocations UNUSED
    dw 0                        ; NumberOfLinenumbers UNUSED
    dd 0                        ; Characteristics UNUSED

;
; Code section data
;

align 4, db 0

code:

;
; Entry point
;

start:
    push base + msg
    call [base + puts]
    call [base + exit]

msg:
    db "Hello, World!",0

crt:
    db "crtdll",0

;
; Import address table (array of IMAGE_THUNK_DATA structures)
;

iat:
puts:   dd 0x800001BB           ; Import puts by ordinal
exit:   dd 0x80000167           ; Import exit by ordinal
        dd 0                    ; terminator

;
; Import table (array of IMAGE_IMPORT_DESCRIPTOR structures)
;

idata:
    dd 0                        ; OriginalFirstThunk UNUSED
    dd 0                        ; TimeDateStamp UNUSED
    dd 0                        ; ForwarderChain UNUSED
    dd crt                      ; Name
    dd iat                      ; FirstThunk

    ; terminator
;    times 5 dd 0 ; too big, padding serves as terminator

codesize equ $ - code

;
; Padding for Windows 10
;
    times 268 - ($-$$) db 0

Previous PE answer: 1175 bytes.

This program was tested on Windows 10 2004 64-bit and Windows XP SP3.

The answer is based on this article, which creates the smallest PE file on Windows XP. I took the smallest file that works on Windows 10 from tinype.zip, which is tiny.296, and added imports using tiny.import.209. Other useful articles: one two.

Quirks:

Windows 10:

  • 268 byte size limit (link)
  • imports must be in a section (link), that's why codesize includes imports

Windows XP:

  • ignores NumberOfRvaAndSizes, it's not a problem because Debug Directory size happens to be 0 (Characteristics field of .text section header) (link)
  • SizeOfHeaders must be nonzero

I think 268 = 4 + 264, where 4 is the minimal offset of NT headers from the start of the file and 264 is the minimal distance between the start of NT headers and end of file. 264 is probably sizeof(IMAGE_NT_HEADERS32)+16 or sizeof(IMAGE_NT_HEADERS64). Because Windows 10 imposes hard limit on minimal PE size, there is no need to cram section header, code and imports into NT headers.

Of the four CRT libraries that are available on both XP and 10 (crtdll.dll, msvcrt.dll, msvcrt20.dll, msvcrt40.dll), I use crtdll.dll because it has a shorter name and has not been updated since 1995, so (it feels like) it's safe to import by ordinals from it. There is no big problem to import by names, but then those names must be inside headers, which is a bit messier.

The program sometimes hangs if puts is imported and ret is used to exit the program (this is true for both crtdll and msvcrt), so I use exit.

\$\endgroup\$
6
\$\begingroup\$

Haifuckqueue, 59 39 bytes

good job to @emanresu A for being epic gamer (shaved off a stanza)

you can only make improvements of 20 bytes at a time because of the haiku 5 7 5 rules lol

{H}$1
{lo, W}
p{l}p
{e}$7
{orld!}
$5ooo

Explanation:

{H}$1    -- overwrite top item on stack with "H" and pop that one item and print it
{lo, W}  -- overwrite top 5 with "lo, W"
p{l}p    -- push 0 to the top of the stack and overwrite it with "l" and push another 0
{e}$7    -- Overwrite the pushed zero with an "e" and print top 7 ("ello, W")
{orld!}  -- Push "orld!"
$5ooo    -- pop and print top 5 and pad with `o` command (xor top 2 items and put result in 3) for haiku 5 7 5 rules

Try it online!

\$\endgroup\$
6
  • 3
    \$\begingroup\$ You probably want to add a timeout on the server - It's currently printing millions upon millions of A to STDOUT with no sign of stopping anytime soon. \$\endgroup\$
    – emanresu A
    Nov 23, 2021 at 9:41
  • \$\begingroup\$ Golfed off a stanza! \$\endgroup\$
    – emanresu A
    Nov 24, 2021 at 18:59
  • \$\begingroup\$ i can't seem to reproduce the million print thing but i think i added a working timeout now of 5 seconds \$\endgroup\$
    – Hydrazer
    Nov 25, 2021 at 22:46
  • \$\begingroup\$ bruh hacks @emanresu \$\endgroup\$
    – Hydrazer
    Nov 25, 2021 at 22:47
  • \$\begingroup\$ i guess you mean if you try to use the goto line number thing it will go forever \$\endgroup\$
    – Hydrazer
    Nov 25, 2021 at 22:59
6
\$\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\$
6
\$\begingroup\$

Halfwit -A, 15 bytes

>JM?M;J*?f?*M[?JN;k+Jkk;$<5b

Try It Online!

Halfwit is an experimental golfing language that fits most commands in half a byte. It only uses lists and integers, so the -A flag allows it to output characters.

This approach is pretty simple. The bit between > and < is the compressed integer 1408073740711211456312062497. 5 is the constant 128, which actually takes up 1.5 bytes because reasons, then b decompresses the integer into base 128.

The naïve approach of using a character list comes out at 19.5 bytes:

>*{>N;>N:>N:>Nk>;{>{+>J;>Nk>f{>N:>N{>{*

Try It Online!

Each segment between > is a base-14 compressed integer.

\$\endgroup\$
6
\$\begingroup\$

TI-BASIC, 22 bytes

"Hello, World!

Note that the lowercase letters are 2 bytes each.

\$\endgroup\$
8
  • 4
    \$\begingroup\$ I don't think the initial : is really part of the program, so I think this has a score of 22. \$\endgroup\$
    – Ypnypn
    Aug 28, 2015 at 16:06
  • \$\begingroup\$ @Ypnypn I'll take your word on it :) \$\endgroup\$ Aug 28, 2015 at 18:45
  • \$\begingroup\$ The colon definitely counts! It's like the C/C++ semicolon, except prefix instead of postfix. If you didn't know, you can enter multiple expressions on a single line by seperating them with a colon. Even if not that, the post asked for a full program, so it has to be there anyways. \$\endgroup\$
    – Itay123
    Mar 14 at 14:51
  • \$\begingroup\$ The lowercase letters can be entered on a TI-84. \$\endgroup\$
    – Wheat Wizard
    Mar 14 at 15:45
  • 1
    \$\begingroup\$ @Itay123 I rolled back your changes because they were mostly incorrect. If you look at the edit history of this question, you will see that the original included a colon. However, most of the readers from 6 years ago preferred it to not be counted. Because of that and the question's age, I would prefer to not re-introduce the colon into the answer. \$\endgroup\$ Mar 15 at 16:28
5
\$\begingroup\$

Forth, 17 bytes

.( Hello, World!)
\$\endgroup\$
6
  • \$\begingroup\$ ." Hello World! is one byte shorter. \$\endgroup\$
    – Lynn
    Aug 28, 2015 at 20:27
  • 1
    \$\begingroup\$ ." may only be used within a function declaration. ." : error(-14): use only during compilation \$\endgroup\$
    – mbomb007
    Aug 28, 2015 at 20:47
  • \$\begingroup\$ Why the space in .( Hello,? \$\endgroup\$ Jun 16, 2016 at 14:56
  • \$\begingroup\$ @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ Forth requires spaces between tokens. The ending ) is the exception to the rule. \$\endgroup\$
    – mbomb007
    Jun 16, 2016 at 14:56
  • \$\begingroup\$ @mbomb007 It's unfair that ." is only in functions. \$\endgroup\$ Jun 16, 2016 at 15:03
5
\$\begingroup\$

Batch File, 19 Bytes

@echo Hello, World!

Short and to the point. You'd think you could golf off the @ at the beginning, but if you do you get the literal program echo'd out before the string is printed. This is why you'll see @echo off at the beginning of near every .bat file around.

Example without the @

C:\Tools\Scripts>.\hello-world.bat

C:\Tools\Scripts>echo Hello, World!
Hello, World!
\$\endgroup\$
8
  • \$\begingroup\$ Isn't the language itself just called "Batch"? \$\endgroup\$
    – mbomb007
    Aug 28, 2015 at 13:54
  • 1
    \$\begingroup\$ @mbomb007 Kinda, sorta, maybe, not really. Batch files are just collections of lines that are executed by the associated command-line interpreter (usually COMMAND.COM but not necessarily, especially in newer Windows releases). It technically has some additional commands, like the infamous GOTO, but it's not in and of itself a language. \$\endgroup\$ Aug 28, 2015 at 14:11
  • \$\begingroup\$ If you leave off the the echo you get an infinite amount of hello world!'s \$\endgroup\$ Aug 28, 2015 at 14:21
  • \$\begingroup\$ @User112638726 No, you should get something like 'Hello' is not recognized as an internal or external command, operable program or batch file. If you get something else, you must be using a different version of the interpreter than I am. \$\endgroup\$ Aug 28, 2015 at 14:28
  • 2
    \$\begingroup\$ @MrPaulch if the filename is significant it has to be added to the byte coutn \$\endgroup\$ Aug 30, 2015 at 23:01
5
\$\begingroup\$

Scala, 22 bytes

print("Hello, World!")

scala can run "scala scripts" which are not full program. you can save the above to a file and execute in the shell scala file.scala, and it will execute (shortcut without saving a file: scala -e 'print("Hello, World!")').

a full ordinary scala program that prints hello world:

object H extends App{print("Hello, World!")}
\$\endgroup\$
5
\$\begingroup\$

Bash, 18 bytes

echo Hello, World!

This works when invoked as a full program or with history expansion disabled (default for scripts).

\$\endgroup\$
5
\$\begingroup\$

Applescript, 15 bytes

"Hello, World!"

Normally a fairly verbose language, for this one this is all that is required.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ It's nice to see these verbose languages -- Applescript, PHP, PowerShell, etc. -- getting the better of lots of other languages for once. :) \$\endgroup\$ Aug 28, 2015 at 15:53
  • \$\begingroup\$ @TimmyD That doesn't mean that they are good languages. It's just that they are better at some things. \$\endgroup\$
    – galexite
    Aug 28, 2015 at 16:53
  • 1
    \$\begingroup\$ @georgeunix Oh, without a doubt. Every language has its pluses and minuses. There are plenty of things I'd change about PowerShell, but there's nothing else I'd rather use to script and config Exchange. Even if it had commands and functionality to do so, I don't think I could use Pyth or CJam or whatnot on a day-to-day basis instead. I was just meaning "It's nice to see non-golfing languages toward the top of the lowest-byte-count list for a change." \$\endgroup\$ Aug 28, 2015 at 17:06
  • \$\begingroup\$ I understand @TimmyD \$\endgroup\$
    – galexite
    Aug 28, 2015 at 17:07
5
\$\begingroup\$

Julia, 22 bytes

print("Hello, World!")

Short and sweet.

\$\endgroup\$
5
\$\begingroup\$

D, 51 bytes

import std.stdio;void main(){puts="Hello, World!";}

In D, a=b is sometimes equivalent to a(b), allowing us to shave off one more byte than you might expect.

\$\endgroup\$
5
\$\begingroup\$

Unlambda, 36 bytes

`.!`.d`.l`.r``.W`. `.,``.l`c`.H.e.oi

Unlambda is a minimal functional programming language based on combinatory logic. It uses prefix notation; `fx is an application of f to x. Specifically, .c is a primitive that takes some v, prints the character c as a side-effect, and returns v. Thus, the usual program would be to take i, apply .H to it, apply .e to it, etc., giving you `.!`.d`.l...

This 36-byte solution is due to irori on anarchy golf. It uses the primitive c, which I think is kind of like call/cc, to avoid having to write .o and .l twice. I have no idea how it precisely works. The sort-of equivalent Lisp syntax would be:

(print-!
  (print-d
    (print-l
      (print-r
        ((print-W
           (print-space
             (print-comma
               ((print-l
                  (call-cc (print-h print-e)))
                print-o))))
         id)))))
\$\endgroup\$
0
5
\$\begingroup\$

4, 117 bytes

3.6000160103602136033260433605446067260787008070200908000120902111120111011015065095105105115055035075115125105085044

How it works

Generating characters with a code point below 100 is straightforward.

I've managed to create the others (derol) with three assignments and five additions/subtractions, which I believe is optimal.

3.            Begin the program.
  6 00 01     Set cell[ 0] to 1.
  6 01 03     Set cell[ 1] to 3.
  6 02 13     Set cell[ 2] to 13.
  6 03 32     Set cell[ 3] to 32 = ' '.
  6 04 33     Set cell[ 4] to 33 = '!'.
  6 05 44     Set cell[ 5] to 44 = ','.
  6 06 72     Set cell[ 6] to 72 = 'H'.
  6 07 87     Set cell[ 7] to 87 = 'W'.
  0 08 07 02  Set cell[ 8] to cell[ 7] + cell[2] =  87 + 13 = 100 = 'd'.
  0 09 08 00  Set cell[ 9] to cell[ 8] + cell[0] = 100 +  1 = 101 = 'e'.
  0 12 09 02  Set cell[12] to cell[ 9] + cell[2] = 101 + 13 = 114 = 'r'.
  1 11 12 01  Set cell[11] to cell[12] - cell[1] = 114 -  3 = 111 = 'o'.
  1 10 11 01  Set cell[10] to cell[11] + cell[1] = 111 -  3 = 108 = 'l'.
  5 06        Print cell[ 6] = 'H'.
  5 09        Print cell[ 9] = 'e'.
  5 10        Print cell[10] = 'l'.
  5 10        Print cell[10] = 'l'.
  5 11        Print cell[11] = 'o'.
  5 05        Print cell[ 5] = ','.
  5 03        Print cell[ 3] = ' '.
  5 07        Print cell[ 7] = 'W'.
  5 11        Print cell[11] = 'o'.
  5 12        Print cell[12] = 'r'.
  5 10        Print cell[10] = 'l'.
  5 08        Print cell[ 8] = 'd'.
  5 04        Print cell[ 4] = '!'.
4             End the program.
\$\endgroup\$
5
\$\begingroup\$

123, 282 267 bytes

22221121121112112222222211211112111211211222222221121121133121121312121122222222111211213
31211213122222222111211332113312112222221112112331123322222221111211111211222221111211211
22222222112111112112112112222222111112112112112222213312112131222222221121113321133121121

The newlines are only for cosmetic purposes. I'm fairly sure that this is not optimal.

Here is a slightly more readable (and also runnable) version:

H 22221121121112112
e 2222222112111121112112112
l 22222221121121133121121312
l 12112
o 22222221112112133121121312
, 2222222111211332113312112
  2222211121123311233
W 222222211112111112112
o 222211112112112
r 2222222112111112112112112
l 222222111112112112112
d 2222133121121312
! 2222222112111332113312112
1

I started out by constructing an optimal linear code (i.e. one which doesn't use 3s which allow for loop). That is quite simple: for each character, determine which bytes to flip from the last one. Move to the right-most character that has to be flipped (with a series of 2s), then move back to the left with 1 for each byte that has to be flipped and 121 for each byte that shouldn't be flipped. Finally move to the writing index -2 and print the character with 21. Repeat. At the very end, move to index -1 with a trailing 1 in order for the program to terminate.

This jumble of 1s and 2s was generated with this CJam script, which you can run online here:

0c"Hello, World!"+2ew::^{
_{2b8Ue[1a/W<1a*_,'2*'1@W%{'1"121"?}/"12"}{;"12112"}?
}/
'1

Then I removed some repetition of ones and twos by inserting loops by hand. 3 works as follows: if the instruction pointer is to the left of index 0, skip the 3. Otherwise, jump to the previous 3 if the current bit is 1 or jump ahead to the next 3 if the bit is 0. So simple loops, repeating a code segment x can be constructed as 33x33 or 33x3 (depending on whether the termination condition is "current bit is zero" or "moved to a negative index"). Then I started enumerating some relevant simple loops and when they are applicable. I've been using these loops only when moving back through the bits to change one character code to the next. If we can use a loop here depends both on the current state of a bit a and the target state b. I'll be denoting this combined state of each position as [a b]. Now here are the relevant loops and the required position patterns in a regex-like syntax:

121:    (^|[0 0]|[0 1]) ([1 1])+ [0 0]
112:    (^|[1 1]) ([0 0])+ ([0 1]|[1 1])
211:    ([0 0]|[0 1]) ([1 1])+ [0 0] ([0 0]|[1 1])
121121: ([0 0]|[0 1]) ([1 1] ([1 1]|[0 0]))+ [0 0]

Listing out the combined states for each character, we can annotate the potential loops and how many bytes they'll save (each ___ annotates the character above; sometimes multiple loops are possible):

H [[0 0] [0 1] [0 0] [0 0] [0 1] [0 0] [0 0] [0 0]]
e [[0 0] [1 1] [0 1] [0 0] [1 0] [0 1] [0 0] [0 1]]
l [[0 0] [1 1] [1 1] [0 0] [0 1] [1 1] [0 0] [1 0]]
        __________________121 -2
  ________________________121121 -3
l [[0 0] [1 1] [1 1] [0 0] [1 1] [1 1] [0 0] [0 0]]
o [[0 0] [1 1] [1 1] [0 0] [1 1] [1 1] [0 1] [0 1]]
        __________________121 -2
              __________________211 -2
  ________________________121121 -3
, [[0 0] [1 0] [1 1] [0 0] [1 1] [1 1] [1 0] [1 0]]
        ________________________211 -2
  [[0 0] [0 0] [1 1] [0 0] [1 0] [1 0] [0 0] [0 0]]
  ____________112 -2
W [[0 0] [0 1] [1 0] [0 1] [0 0] [0 1] [0 1] [0 1]]
o [[0 0] [1 1] [0 1] [1 0] [0 1] [1 1] [1 1] [1 1]]
r [[0 0] [1 1] [1 1] [0 1] [1 0] [1 0] [1 1] [1 0]]
l [[0 0] [1 1] [1 1] [1 0] [0 1] [0 1] [1 0] [0 0]]
d [[0 0] [1 1] [1 1] [0 0] [1 0] [1 1] [0 0] [0 0]]
        __________________121 -2
  ________________________121121 -3
! [[0 0] [1 0] [1 1] [0 0] [0 0] [1 0] [0 0] [0 1]]
        ________________________211 -2

Now I just picked the most profitable loop in each case and inserted it into the code.

I'm fairly certain that one could find a couple more loops that I've overlooked. But I also think that it's possible to find a significantly shorter solution that isn't based on anything a human would come up with. So far I have no idea how to efficiently search for such a solution automatically though, so I'll leave it at that for now.

\$\endgroup\$
5
\$\begingroup\$

goruby, 6 bytes

h:H,:W

Apart from the method_missing override, goruby also defines Kernel#h which accepts 3 parameters: the first letter of _ello (default H), the first letter of _orld (default w), and the final character (default !).

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Nice, I didn't know about the parameters it takes :) \$\endgroup\$
    – Lynn
    Sep 3, 2015 at 2:00
5
\$\begingroup\$

Turing Machine Code, 132 bytes

As usual, I'm using the table syntax defined here.

0 * H r q
q * e r w
w * l r e
e * l r r
r * o r t
t * , r y
y * _ r u
u * W r i
i * o r o
o * r r p
p * l r a
a * d r s
s * ! r halt

If the above link isn't working (sometimes it works for me, other times the page refuses to load) you may also test this using this java implementation.

\$\endgroup\$
5
\$\begingroup\$

Candy, 18 bytes + 1 = 19 bytes

Push (technically queue) string (character-by-character) onto the stack, and loop to print

"Hello, World!"(;)

The interpreter should be called with -q to suppress STDOUT messages.

\$\endgroup\$
3
  • \$\begingroup\$ Why 3 bytes for switch? The Binary-encoded Golfical answer takes a switch and that's only a byte... \$\endgroup\$
    – cat
    Dec 14, 2015 at 14:23
  • \$\begingroup\$ There was a suggestion on one of my other posts that suppressing STDOUT should have a cost, so I followed that here. But it doesn't seem to be consistently followed. \$\endgroup\$ Dec 14, 2015 at 22:44
  • \$\begingroup\$ The convention is typically 1 byte / switch. However, you can raise the question on Meta and get the community's opinion. \$\endgroup\$
    – cat
    Dec 14, 2015 at 22:56
5
\$\begingroup\$

Rotor, 14 bytes

"Hello, World!

Nothing too fancy here. Like Pyth, quotes and most other structures are implicitly closed at EOF.

Try it online.

Check out Rotor.

\$\endgroup\$
5
\$\begingroup\$

68k machine code (EASy68k), 30 bytes

00000000: 303c 000d 43f9 0000 1010 4e4f ffff ffff  0<..C.....NO....
00000010: 4865 6c6c 6f2c 2057 6f72 6c64 2100       Hello, World!.

I don't know what I'm doing!

Explanation

    ORG    $1000
START:                  ; first instruction of program

    MOVE #13, D0        ; put text display task number in D0
    LEA HELLO, A1       ; load address of string to display into A1
    TRAP #15            ; activates input/output task

    SIMHALT             ; halt simulator

HELLO DC.B 'Hello, World!',0

    END    START        ; last line of source
\$\endgroup\$
0
5
\$\begingroup\$

Your Mom, 14 bytes

'Hello, World!

Explanation

'...
'... - Push the string. The ending ' is not needed at the end of program
     - Implicit output
\$\endgroup\$
5
\$\begingroup\$

HolyC, 24 bytes

Print("Hello, World!");

Nothing special here, I just wanted to pay tribute to the lunatic who wrote TempleOS and its companion language, HolyC.

\$\endgroup\$
5
\$\begingroup\$

TP, 17,806 bytes

TP is a language I created based on using toilet paper.

The main operation is USE TP which removes a sheet (1) from the current roll (cell), each roll starts at 255 sheets. There is also GET TP which adds a new roll to the toilet paper pile. There is also the accompanying NEW TP and OLD TP which switches to a newer roll or older roll respectively. The final notable command is DIS TP which displays the ASCII value for the current roll.

This is included as tphelloworld.tp for the interpreter download.

This can definitely be shorter.

USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

GET TP
NEW TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
USE TP
DIS TP

Notes About the Interpreter

The interpreter always removes whitespace from the working line, so USE TP becomes USETP, this allows a 1 byte decrease per line. Since the interpreter uses Python, I believe newline style (CR+LF, LF) doesn't matter. A thing that I'm trying to think of a way to do is add a separator (command; command). If I figure out a way to implement that, then the filesize can be drastically reduced.

\$\endgroup\$
7
  • \$\begingroup\$ Doing a quick estimate you can probably get this down to around 6500 bytes. I would write it up but I can't at the current time (if I get some time this weekend I'll run through it). \$\endgroup\$ Nov 18, 2016 at 16:00
  • \$\begingroup\$ Nice! I'm surprised anyone actually cares about this. \$\endgroup\$ Nov 18, 2016 at 17:51
  • 6
    \$\begingroup\$ damn, that's a lot of trees cut down... \$\endgroup\$
    – FlipTack
    Nov 18, 2016 at 18:27
  • \$\begingroup\$ @Flp.Tkc Maybe I should make a version where you plant trees? \$\endgroup\$ Nov 18, 2016 at 18:33
  • \$\begingroup\$ Calculation for chars(6405 bytes) H=(255-72)*"USE TP "+"DIS TP " e="GET TP NEW TP "(255-101)*"USE TP "+"DIS TP " l="GET TP NEW TP "+(255-108)*"USE TP "+"DIS TP " l="DIS TP " o="GET TP NEW TP "+(255-111)*"USE TP "+"DIS TP " ,="OLD TP OLD TP OLD TP "+(72-44)*"USE TP "+"DIS TP " =(44-32)*"USE TP "+"DIS TP " W="NEW TP "+(101-87)*"USE TP "+"DIS TP " o="NEW TP NEW TP DIS TP " r="GET TP NEW TP "+(255-114)*"USE TP "+"DIS TP " l="OLD TP OLD TP DIS TP " d=(108-100)*"USE TP "+"DIS TP " !="OLD TP "+(87-33)*"USE TP "+"DIS TP " \$\endgroup\$ Nov 21, 2016 at 9:03
5
\$\begingroup\$

K (oK), 20 19 bytes

!`0:"Hello, World!"

Try it online!

Note that this program gets killed, which effectively prevents implicit or error output. Your shell might indicate that the program was killed, but this output is produced by the shell, not the program.

Alternative solution, 20 bytes, clean exit

{}`0:"Hello, World!"

I'm still trying to figure out why this works, but it does.

Try it online!

Almost-solutions

  • "Hello, World!" prints the string with the quotes.

  • `0:"Hello, World!" prints Hello, World!"Hello, World!", the first copy explicitly, then second one implicitly.

  • 0`0:"Hello, World!" prints the correct output to STDOUT, but the leftmost 0 is a type error and prints an error message to STDERR.

  • !`0:"Hello, World!" prints on

\$\endgroup\$
2
  • 6
    \$\begingroup\$ You know you've attained master rank when you don't know why your code golf works, but it still does. \$\endgroup\$ Feb 9, 2017 at 20:20
  • \$\begingroup\$ Of course. The true&tested method of "Can't possibly work, let's try it anyway." ~ Eugene van der Pijll \$\endgroup\$
    – primo
    Feb 10, 2017 at 11:16
5
\$\begingroup\$

Wise, 135 + 3 = 138 bytes

~-<<<~-<<<::^~-<~-<<<~-<<~-:::^~-<<<~-^::?:>~-<~-:?::^~-<<~-<~-<<::^~-<<<<<:<::^<~-<<~-<~-<~-|!::^~-<~-<~-<<<~-<!:::^~-<<<^::^~-<<<<<~-

Try it online!

\$\endgroup\$
5
\$\begingroup\$

Alice, 19 18 bytes

Thanks to Sp3000 for saving 1 byte.

"&O@!dlroW ,olleH

There should be a carriage return (0x0D) at the end of the program, but browsers don't like those. Consequently, this version is also not testable on TIO. Here is a 19-byte printable-only alternative:

"!dlroW ,olleH"d&O@

Try it online!

Finally introducing my latest language! This works like Hello, World in most Fungeoids, and doesn't really touch upon all the advanced features Alice has:

"&O@!dlroW ,olleH  Push the individual code points of the entire source code
                   except the " to the stack. Remember that there's a 13 at the end.
&                  Repeat the next command 13 times.
O                  Pop 13 characters from the stack and print them.
@                  Terminate the program.

In the 19-byte version, we're pushing the 13 explicitly, using the stack depth command d.

Here is a somewhat more interested 21-byte version, which makes use of Alice's main feature: by moving diagonally, Alice operates in a separate mode (called Ordinal mode), which works with strings instead of integers. However, due to the diagonal movement, it's a bit harder to follow the code:

/oH!lloo /
@""edlr,W\

Try it online!

The initial / sends the instruction pointer off southeast, where it will bounce diagonally up and down between the two lines. The \/ at the end offset the IP's position by one cell so that on the way back, the IP bounces through the other characters. So ignoring those mirrors, the code that actually gets executed is:

"Hello, World!"o@

In Ordinal mode, "Hello, World!" actually pushes an entire string to the stack, o prints that string, and then @ still terminates the program.

\$\endgroup\$
5
\$\begingroup\$

Aceto, 19 bytes

Aceto is the coolest programming language because I got it as a birthday present. It is a stack based programming language that makes use of a 2D Hilbert curve grid. Here is Hello World:

o,or
l Wl
le!d
"H"p
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Golfed 16+1=17 for -l flag \$\endgroup\$
    – drham
    Mar 9, 2018 at 20:28
1
4 5
6
7 8
31

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.