Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics

Dashboard
Notifications
Mark all as read
Challenges

"Hello, World!"

+15
−0

Introduction

The classic "Hello, World" challenge. What more can I say?

Rules

  • Program takes no input.
  • Program outputs Hello, World! with an optional trailing newline. No other output is accepted.

Shortest submission in bytes wins.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

5 comments

Just wondering, this challenge already exists on codegolf.SE, so what's to stop people from copying everything from there? mbomb007‭ 5 months ago

@mbomb007 I imagine nothing. Some challenges may make sense to copy over as not everyone wants to use SE (some still have bitter feelings about it) However, I think people will have some incentive to be creative and make new challenges anyways. moony‭ 5 months ago

It's quite funny how this is the first question, considering "Hello, World!" is the first thing most people do when they first start coding-- much alike the first question on Codidact Code Golf being "Hello, World!" 22t‭ 5 months ago

Giving old challenges a new look makes sense to me. People who answered Somewhere Else and want to copy those answers here can (you own your content), but you might have also thought of better solutions since then, too. Monica Cellio‭ 5 months ago

@mbomb007, mostly a matter of tradition more than anything. Hello world is more of a catalog type question than a serious competitive one. Razetime‭ 5 months ago

23 answers

+5
−0

PHP, 13 bytes

Hello, World!

PHP by default prints all source to output until it encounters <? or <?php.

Why does this post require moderator attention?
You might want to add some details to your flag.

2 comments

Polyglot with Canvas, Charcoal, and possibly a couple more golflangs dzaima‭ 5 months ago

More importantly, polyglot with Text Razetime‭ 5 months ago

+5
−0

Vyxal, 2 bytes

KH

This pushes the string "Hello, World!" to the stack and automatically prints it.

Also, this is the first answer on the site! Woo!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+4
−0

Shakespeare Programming Language, 974 bytes

Only 973 bytes away from winning.

a.Ajax,.Puck,.Act I:.Scene I:.[Enter Puck and Ajax]Puck:You is the cube ofa big big cat.Ajax:You is the sum ofI a big big big cat.Speak thy!You is the sum ofthe sum ofthe sum ofI a big big big big big cat a big big cat a cat.Speak thy!You is the sum ofthe sum ofyou a pig a big big big cat.Speak thy!Speak thy!You is the sum ofthe sum ofyou a big cat a cat.Speak thy!You is the sum ofthe sum ofthe sum ofyou a pig a big pig the cube ofa big big pig.Speak thy!You is a big big big big big cat.Speak thy!You is the sum ofthe sum ofthe sum oftwice I a big big big pig a big big big big big pig a pig.Speak thy!You is the sum ofthe sum ofthe sum ofyou a big big big cat a big big big big big cat a big big big big pig.Speak thy!You is the sum ofthe sum oftwice I a big big big big pig a big cat.Speak thy!You is the sum ofthe sum ofyou a big pig a big big pig.Speak thy!You is the sum ofyou a big big big pig.Speak thy!You is the sum ofa big big big big big cat a cat.Speak thy!

Spent a good amount of time golfing this. I'm sure there's a few optimizations I've missed, but I don't understand the word "big" anymore.

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

2 comments

Gah, I've just checked SE and they've got it down to 835. I guess I can't golf hard enough. Corsaka‭ 5 months ago

What optimisations is TIO missing? As far as I know, it is using the reference interpreter provided by the language's authors (which itself has a number of bugs to exploit). Also, the shortest on SE is 592 bytes Jo King‭ 5 months ago

+6
−1

Javascript V8, 888 bytes

                                  $=-~[]
                                 *~-((~-~
                                [])**  -~-
       ~[]);        _$=$+       ~[];$$_=_$
      +$;$$={      }+[];_$$      =![]+[];
     $_=!![]+[    ];$=$$[$+_$    ]+$$[-~
    []]+(_$$[![  ]+[]]+[])[-~  []]+_$$[
   _$-~[]]+$$[$+$]+$_[-~[]]+$_[_$]+$$[
  $+$+~[]]+$$[$+_$-~[]]+$$[-~[]]+$_[-
 ~[]];$$='\\x';_=(_$**(_$+_$-~[]))+
_$**(_$-~[]);__=_+_/_$;$[$][$](_$$[-
 ~[]]+_$$[_$]+_$$[_$+_$]+$_[-~[]]+
  $_[+[]]+"('"+$$+(_+_$**(_$-~[])
   )+$$+(__+$$_)+$$+(__+[])[+[]]
   +({  }+[           ])[   $$_
  ]+$$  +(__         +[])   [+[]
 ]+({    }+[]      )[$$_     ]+$$
+(__     +[])      [+[]]     +_$$
[+[]     ]+$$      +_/_$     +$$+
(__-     _$+~      [])+      $$+(
__+[     ])[+      []]+      _$$[
+[]]     +$$+      (__+     __/$$_
)+$$     +(__      +[])     [+[]]+
({}+[])  [$$_]+$$+ (__+_$+  _$)+"')")()

Absolutely the shortest possible, no doubt about it. Try it online!. It won't work in the online one, copy it from there and paste it in the developer console if you are on chrome (as it uses the alert function). Please excuse my absolutely awful ascii art.

I also now see that this output isn't accepted (needs the comma and exclamation mark)... lol now it's time to figure out how I did this months ago so I can fix it ...

Why does this post require moderator attention?
You might want to add some details to your flag.

3 comments

"undefined:3: ReferenceError: alert is not defined alert('\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64') ^ ReferenceError: alert is not defined at eval (eval at (.code.tio:11:31), :3:1) at .code.tio:24:38" DonielF‭ 5 months ago

Read past the link ;) ZippyMagician‭ 5 months ago

You can golf this pretty easily by removing all the whitespace. I'm not sure what restricted character set you've decided to program this under, since it has quotes and an x in it, both of which could surely be used elsewhere to make it shorter. Jo King‭ 5 months ago

+3
−0

Common Lisp, 26 22 bytes

(princ"Hello, World!")

-4 bytes thanks to @Sisyphus‭

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+2
−0

HQ9+, 1 byte

H

Obligatory HQ9+ answer.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+2
−0

C# 9, 38 bytes

System.Console.Write("Hello, World!");

C# Version 9 introduced Top level statements.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+2
−0

SOGL, 10 bytes

╥‰~⅜,(ε	‘ū

Try it here!

Built-in compression of "hello"; ", "; "world"; "!", with first letters of words uppercased.

Why does this post require moderator attention?
You might want to add some details to your flag.

2 comments

Is Canvas longer? Razetime‭ 5 months ago

Canvas doesn't have English compression, so it's as long as just the string constant itself. dzaima‭ 5 months ago

+2
−0

Python 2, 20 bytes

print"Hello, World!"

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+2
−0

QBASIC, 17, 16 bytes

?"Hello, World!"

This should work on almost any BASIC interpreter.

Thanks to manassehkatz, for the space.

Why does this post require moderator attention?
You might want to add some details to your flag.

2 comments

Is a space needed between the ? and the first " ? manassehkatz‭ 2 months ago

@manassehkatz, I was concerned about any modern tokenizing implementations not supporting the reduced format. I have adjusted the answer. Thanks. strom‭ 2 months ago

+2
−0

Perl 5 -E, 18 bytes

say"Hello, World!"

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+3
−1

Raku, 19 bytes

"Hello, World!".say

Explanation

First second answer of the.. entire site, actually. Nothing special. I don't think this can go shorter, but this is Raku, who actually knows. I made this post to (possibly) try and set a precedent for what a answer should look like. Obv you don't have to explain it, but it's nice.

Try it Online!

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment

Do host your answers on Try it online! Razetime‭ 5 months ago

+1
−0

AppleScript, 15 bytes

"Hello, World!"

No, I'm not joking. This ridiculous language for a code golf actually beats some of the more normal languages.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+1
−0

C++ (gcc), 43 bytes

#import<ios>
main(){puts("Hello, World!");}

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

3 comments

Apart from using deprecated gcc extensions, this is non-conforming/ill-formed C++ with several constraint violations. Lundin‭ 5 months ago

@Lundin Top line states that it's for gcc (which implies only for gcc). It's also conformant code, please read the standard before commenting. Noodle9‭ 5 months ago

How can you say that it relies on non-standard extensions while lecturing me about the standard at the same time? It's either, not both at once. Lundin‭ 5 months ago

+1
−0

JavaScript (V8), 28 bytes

console.log("Hello, World!")

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment

isn't alert() shorter? Razetime‭ 5 months ago

+1
−0

RoadLang, 59 bytes

wagwan my slime
man say"Hello, World!"
chat wit u later fam

My first RoadLang answer! And probably the first one on this site!

Removing any of the words says "Aight the lad's lost the plot", so I think this is the most minimal answer I can get here.

Thanks to Quintec for patching string parsing so that this works.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+1
−0

ARBLE, 15 bytes

"Hello, World!"

Simple use of Implicit IO. Polyglot with half a dozen golf langauges.

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+1
−0

05AB1E, 7 bytes

”Ÿ™,‚ï!

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+1
−0

LOLCODE, 37 bytes

HAI 1
VISIBLE "Hello, World!"
KTHXBYE

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+1
−0

Japt, 11 bytes

`HÁM, WŽld!

Just using Japt's builtin compression.

Test it

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!