"Hello, World!"
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.
Shakespeare Programming Langua …
4y ago
Vyxal, 2 bytes KH Th …
4y ago
PHP, 13 bytes Hello, Wo …
4y ago
HQ9+, 1 byte H Oblig …
4y ago
[Common Lisp], 26 22 bytes …
4y ago
QBASIC, 17, 16 bytes ?" …
3y ago
C# 9, 38 bytes System.C …
3y ago
Javascript V8, 888 bytes ```j …
4y ago
Perl 5 `-E`, 18 bytes ``` …
3y ago
[Python 2], 20 bytes …
4y ago
[C# (.NET Core)], 60 bytes …
3y ago
05AB1E, 7 bytes ”Ÿ™,‚ï! …
4y ago
LOLCODE, 37 bytes HAI 1 …
4y ago
[C++ (gcc)], 43 bytes …
4y ago
R, 20 bytes ``` cat("Hello …
4y ago
[Bash], 18 bytes ec …
4y ago
SOGL, 10 bytes ╥‰⅜,(ε ‘ū …
4y ago
///, 13 bytes ``` Hello, W …
3y ago
[PowerShell], 15 bytes …
3y ago
[RoadLang], 59 bytes …
4y ago
AppleScript, 15 bytes " …
4y ago
[JavaScript (V8)], 28 bytes …
4y ago
[ARBLE], 15 bytes " …
4y ago
Japt, 11 bytes `HÁM, W …
4y ago
Raku, 19 bytes ``` "Hello, W …
4y ago
J, 15 bytes ``` 'Hello, Wo …
3y ago
[dc], 16 bytes [Hello, …
3y ago
[Seriously], 1 byte H …
3y ago
[Unlambda], 40 bytes `` …
3y ago
[Haskell], 25 bytes …
3y ago
Turing Machine.io, 202 bytes …
3y ago
Scala, 42 bytes object>e …
3y ago
[C# (.NET Core)], 67 bytes …
3y ago
Rockstar, 19 bytes say …
3y ago
PureScript, 25 bytes ``` m …
3y ago
Swift, 23 bytes ```swift p …
3y ago
Kotlin, 34 bytes ```kotlin …
3y ago
[Forth (gforth)], 16 bytes …
3y ago
HTML, 26 13 bytes ``` Hell …
3y ago
[C (gcc)], 30 bytes …
5mo ago
[K (oK)], 15 bytes "Hel …
5mo ago
[AWK], 2 bytes $0 Tr …
5mo ago
C (gcc), 46 bytes ```cpp pri …
2y ago
Z80 Assembler, 50 bytes ``` …
2y ago
JavaScript V8, 26 bytes ``` …
2y ago
SOS, 155 Bytes !+!-!!+! …
2y ago
[shortC], 16 bytes AJ"H …
3y ago
[jq] `--null-input` `--raw-out …
3y ago
[SQLite], 21 bytes sele …
3y ago
[Emoji], 24 bytes 💬Hell …
3y ago
[Sclipting], (UTF-16) 18 bytes …
3y ago
[Java (JDK)], 80 bytes …
3y ago
[Chef], 558 485 bytes H …
3y ago
[Forget], 319 bytes pus …
3y ago
Lean, 64 bytes ```lean def …
3y ago
[!@#$%^&()+], 17 bytes …
3y ago
[Pyth], 14 bytes "Hello …
3y ago
Bash, 21 Bytes ```bash pri …
3y ago
[Charcoal], 13 bytes He …
3y ago
Java, 37 Bytes ```java v-> …
3y ago
[Lua], 20 bytes pri …
3y ago
61 answers
C (gcc), 30 bytes
main(){puts("Hello, World!");}
This is using GNU C extensions. GNU C allows main()
over int main()
, ss well as using puts
without including stdio.h.
0 comment threads
SOS, 155 Bytes
!+!-!!+!-!!!!+!!-!!+!-!+!-!+!!-!+!!-!!!+!!-!+!!-!!!+!!-!+!!!!-!!+!-!+!!-!!!!+!-!!!!!!+!-!+!-!+!!!-!+!!-!+!!!!-!+!!!-!!+!-!!+!!-!+!!-!!!+!!-!!+!-!!+!-!!!!+!
Explanation:
Each !
outputs a single bit. That bit is 0 if the current stack is empty, and 1 otherwise. Initially the stack is empty. +
adds something (an empty stack) to it, and -
removes it. As soon as 8 bits are output, the corresponding byte is sent to stdout. Therefore the sequence up to the 8th !
, !+!-!!+!-!!!
outputs the bit sequence 01001000, which is the ASCII code for the letter H.
The last character uses the fact that if at the end of the program less than 8 bits are output, the value is left-padded with zeros, and the resulting byte is output. So with comments (and spaces to make the output commands line up), the program reads like this:
!+!-! !+!-! ! ! Output 01001000, i.e. H
!+! !-! !+!-!+! Output 01100101, i.e. e
-!+! !-!+! !-! ! Output 01101100, i.e. l
!+! !-!+! !-! ! Output 01101100, i.e. l
!+! !-!+! ! ! ! Output 01101111, i.e. o
-! !+!-!+! !-! ! Output 00101101, i.e. comma
! !+!-! ! ! ! ! Output 00100000, i.e. space
!+!-!+!-!+! ! ! Output 01010111, i.e. W
-!+! !-!+! ! ! ! Output 01101111, i.e. o
-!+! ! !-! !+!-! Output 01110010, i.e. r
!+! !-!+! !-! ! Output 01101100, i.e. l
!+! !-! !+!-! ! Output 01100100, i.e. d
+!-! ! ! !+! Output 00100001, i.e. exclamation mark
0 comment threads
C (gcc), 46 bytes
printf(char*);main(){printf("Hello, World!");}
printf(char*);
(14 bytes) is better than
#include <stdio.h>\n
(19 bytes)
Forget, 319 bytes
push 72;cleanse;pop;out;push 101;cleanse;pop;out;push 108;cleanse;pop;out;push 108;cleanse;pop;out;push 111;cleanse;pop;out;push 44;cleanse;pop;out;push 32;cleanse;pop;out;push 87;cleanse;pop;out;push 111;cleanse;pop;out;push 114;cleanse;pop;out;push 108;cleanse;pop;out;push 100;cleanse;pop;out;push 33;cleanse;pop;out
Oh, sorry. I forgot.
0 comment threads
!@#$%^&*()_+, 17 bytes
^dlroW ,olleH(@)
Might learn this sometime but I found this.
0 comment threads
Charcoal, 13 bytes
Hello, World!
I'm surprised no one even used Charcoal in the challenge. Guess I'll take it.
0 comment threads
Chef, 558 485 bytes
H.
Ingredients.
72 l H
101 l e
108 l l
111 l o
44 l _comma
32 l _space
87 l w
114 l r
100 l d
33 l _bang
Method.
Put _bang into mixing bowl.Put d into mixing bowl.Put l into mixing bowl.Put r into mixing bowl.Put o into mixing bowl.Put w into mixing bowl.Put _space into mixing bowl.Put _comma into mixing bowl.Put o into mixing bowl.Put l into mixing bowl.Put l into mixing bowl.Put e into mixing bowl.Put H into mixing bowl.Pour contents of mixing bowl into baking dish.
Serves 1.
A funny language, indeed. Will need help figuring out how to golf this, because yikes, it's so big.
0 comment threads
Z80 Assembler, 50 bytes
org 256
ld de,m
ld c,9
jp 5
m:db"Hello, world!\r$"
With assembler there's usually the problem which machine or operating system the program is for. I've chosen CP/M here as it runs on a variety of different machines with a Z80 processor.
CP/M programs start at address 0x100, but the decimal representation 256 is shorter.
The program loads the address of the $-terminated string into the D & E register pair, then the number of the print text subroutine (9) into the C register, and jumps to the BDOS entry. It uses the RET
urn of that routine to end itself, instead of CALL
ing the BDOS and needing an own RET
instruction in the program.
0 comment threads
Lean, 64 bytes
def hello_world:io unit:=put_str"Hello, World!"#eval hello_world
0 comment threads
Java (JDK), 80 bytes
class A{public static void main(String[] A){System.out.print("Hello, World!");}}
This answer, except it's actually runnable.
0 comment threads
- ← Previous
- 1
- 2
- 3
- 4
- Next →
1 comment thread