| Bytes | Lang | Time | Link |
|---|---|---|---|
| nan | brainfuck | 250404T001704Z | Andrew B |
| 025 | Vyxal | 210428T201622Z | Aaroneou |
| 202 | Batch 39 Lines | 150331T020415Z | unclemea |
| 029 | Retina | 170322T180609Z | mbomb007 |
| 094 | Marbelous | 150405T084418Z | es1024 |
| nan | JavaScript 67 66 62 lines | 150328T145031Z | kennytm |
| 095 | Ruby | 150331T200116Z | histocra |
| 3659 | PHP 7 / 17 lines | 150327T122159Z | Ismael M |
| nan | Unary | 150330T161743Z | mbomb007 |
| 143 | Forth | 150329T020835Z | mbomb007 |
| nan | ><> Fish | 150328T150925Z | randomra |
| 051 | Rebol 15 lines | 150328T152746Z | draegtun |
| 017 | Perl | 150329T145821Z | nutki |
| 111 | ><> | 150327T151212Z | Sp3000 |
| 366 | Headsecks | 150328T032301Z | Sp3000 |
| 162 | CJam | 150327T170236Z | Sp3000 |
| 060 | Cygwin bash | 150327T130256Z | n̴̖̋h̷͉̃ |
| 059 | Insomnia | 150327T054259Z | n̴̖̋h̷͉̃ |
| 022 | /// | 150327T072920Z | Martin E |
| 023 | Pyth | 150327T040602Z | isaacg |
brainfuck, 377 bytes (12 lines)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
+++++++++++++++++++++++++++++.
+++++++..
+++.
-------------------------------------------------------------------.
------------.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++.
++++++++++++++++++++++++.
+++.
------.
--------.
-------------------------------------------------------------------.
Inspired largely by Sp3000's answer. Thought we should call out how to do this in BF.
Vyxal, 9 lines, 25 bytes
`
Hello
,
Wor
l
d
!`
\
-
` #
Hello |
, |
Wor | Push 'Hello\n,\n Wor\nl\nd\n!'
l |
d |
!` #
\ # Push '\n'
- # Remove all '\n' from 'Hello\n,\n Wor\nl\nd\n!'
# Implicit output
Batch - 39 Lines (202 bytes)
I wanted to cut down on the size by enabling delayed expansion by running the code inside of a cmd call using the /v on switch, but could not get past all the carats.
@S^
ET^
LO^
C^
AL^
EN^
ABL^
E^
DEL^
AY^
E^
DEX^
P^
ANS^
IO^
N
@S^
ET^
0=Hello
@S^
ET^
1=^
,^
Wor
@S^
ET^
2=l
@S^
ET^
3=d
@E^
CHO^
!^
0^
!!1^
!!2^
!!3^
!^^^
!
Without the newlines (and carats to escape newlines):
@SETLOCAL ENABLEDELAYEDEXPANSION
@SET 0=Hello
@SET 1=, Wor
@SET 2=l
@SET 3=d
@ECHO !0!!1!!2!!3!^^!
Retina, 12 lines, 29 bytes (non-competing)
The language is newer than the challenge.
Hello
$
,
$
Wor
$
l
$
d
$
!
Marbelous, 9 lines, 94 bytes
3333
@ADD
358C
++--29\\
++--3555DE
<<<<<<>>~~
+++++446666D
++++++++../\
++------
Test it online here. Using spaces for blank cells must be checked.
Visual representation of source:

Explanation: Each hexadecimal value in this program moves downward every "tick" (unless it is on \\, in which case it moves to the right). ++ will increment the value, -- decrement, ~~ apply a bitwise not, etc. Values that fall of the bottom are printed as an ASCII character.
For example: The 33 in the top corner becomes (((0x33 +1 +1) << 1) +1 +1 = 0x6C (l).
JavaScript (67 66 62 lines, 227 269 bytes)
(Note: only tested on Firefox 36 and Safari 8, contains minor ES6 features (the Set class))
Z
=
!""+
(0[[]]
+
(
!!""+Set
));c
=Z[~
-22]
$=Z[
3]
$$=Z[
15]
$$$=Z[
24]
$$$$=Z[
1]
$$$$$=Z[
0]
Set
[c
+
$$$+Z[
5]
+Z[
16]
+
$$$$$+
$$$$+Z[
2]
+c
+
$$$$$+
$$$+
$$$$]
(Z[
14]
+
$$+
$+
$$$$+
$$$$$+
"(\
'H\
"+
$+
$$+
$$+
$$$+
",\
W\
"+
$$$+
$$$$+
$$+Z[
6]
+
"\
!')\
")
()
The code above basically does:
alert("Hello, World!")
Obviously alert is not sorted. So instead we need to generate the statement as a string, and "eval" it:
s = "alert('Hello, World!')"; // generate this using sorted code
eval(s)
How to generate the string? ES5 supports line continuation so that
"AL\
ERT" === "ALERT"
But the character code \ appears before all lowercase letters, so we have to generate the lowercase letters using other methods.
We borrow some idea of JSFuck here. The lowercase letters involved in the alert statements are:
t e r a o l d
all of these can be extracted from characters of standard objects, which may be expressed in terms of some sorted sequence:
t, e, r ← true = !""
a, l ← false = !!""
o ← function = Set
d ← undefined = 0[[]]
How do we evaluate the string? Surely we cannot use eval(s) as it is not sorted. Alternatively we could use Function(s)(), but we cannot use Function as it is not sorted either. However, Function is the constructor of all functions, which means Set.constructor === Function.
Adding the identifier constructor makes the list of lowercase letters become:
t e r a o l d c u n s
which fortunately could still be generated by "truefalseundefinedfunction":
t, e, r, u ← true = !""
a, l, s ← false = !!""
o, c, n ← function = Set
d ← undefined = 0[[]]
After prettifying, the code above should read like:
// lines 1~8 defines our string containing all lowercase letters we want
Z = true + (undefined + (false + Set))
// Z = "trueundefinedfalsefunction Set() { [native code] }"
// lines 8~20 defines the variables `c`, `$` (e), `$$` (l), `$$$` (o),
// `$$$$` (r), `$$$$$` (t)
// for the corresponding lowercase letters extracted from `Z`
// the rest calls:
Set["constructor"]("alert('Hello, World')")()
// lines 22~36 generates the "constructor" string
// lines 37~61 generates the "alert('Hello, World')" string
Update: Renamed E, L, O, R, T to various repetition of $ to reduce 4 lines.
Ruby, 19 lines, 95 bytes
$;=
$>
$;<<
:Hello
$;<<
44::chr
$.=
33::
-1
$;<<
$.::chr
$;<<
:Wor
$;<<
:l
$;<<
:d
$;<<
33::chr
Possibly the second-hardest code restriction for Ruby I've seen on this site, after the monstrosity here.
Edit for explanation: The only Ruby output method that's sorted is the << method on STDOUT. Unfortunately, the constant for STDOUT is $>, and > is higher ASCII than most symbols, so it's not really possible to call a method on it. We need a multi-line assignment statement to get it into a more tractable variable name, $; (semicolon is still pretty high, but most variables of this form are either non-assignable, or can only be strings).
Symbols (:Wor, etc. ) are the easiest way to do a literal, and I don't see a way to strip newlines from a string, so I need multiple print statements. The space and punctuation can't go into a symbol literal, but luckily the chr method on numbers is legal, so I can get a character from its ASCII value. :: is an alternate way of calling methods. Space is tricky because I can't write 32, so I subtract 1 from 33 and assign it to a variable.
PHP (7 / 17 lines, 36 / 59 bytes):
Due to the amount of invalid answer, I rewrote this answer.
The browser version? Gone.
But I have 2 solutions, both based on bitwise xor (^) of strings in PHP.
This is an extremely powerful solution! Sometimes, it allows to save plenty of bytes.
First, the shortest answer:
Echo
Hello
,AM^mm
,Wor
,OOO^
"#+n
";
I know, it looks awful, but it works!
The next one depends on newlines.
Yes, it uses newlines (\n/UNIX style is required)!
Echo
Bo
.ff
.e
.
"&*]ex
fn
"^
"\n
\n
\n
\n
\n
\n
\n
",B^c
;
The newlines on this one are required to work.
It isn't perfect, but works!
Both answers were based on @MartinBüttner's solution:
Echo
Hello
.
chr
(44
).
chr
(29
+3
).Wor
.l
.d
."!
";
A special thank to @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳, @CJDennis, @MartinBüttner and @skagedal for detecting all my mistakes and for their suggestions.
Unary, 1 line, lots of bytes
Every character in this program is 0. The source is too long to put in here, but it consists of a string of this many zeros:
327380789025192647555922325233404088310881092761595127419003295178342329930050528932118548
This is the decimal representation for this binary number:
0b1010010010010010010010010110000010010010010110000010010000010010010000010010010000010001001001001011111000010000010000011110001111001011111000000100000011011011100010010010010010010010100100010010010100000000100001011100001100010010010100011011011011011011100011011011011011011011011100000000010100
Which was created from this BrainF*** program:
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>-[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.
See how I generated it: http://ideone.com/lMT40p
Forth, 41 lines, 143 bytes
I'm very proud of this. I whipped it out pretty quickly once I found I could do it, having Google searched for case-insensitive languages, and I already know Forth decently. It can almost definitely be shortened, both bytes and lines. Suggestions are appreciated. :D
This program essentially pushes the decimal value of each ASCII character, then prints each one. I attempted to optimize while I wrote it, hence it is less readable than I'd like.
33
99
1
+
DUp
8
+
2DUp
6
+
SWap
11
+
2OVer
SWap
8
9
*
EMit
1
+
EMit
DUp
DUp
EMit
EMit
3
+
EMit
29
3
2DUp
+
EMit
*
EMit
EMit
EMit
EMit
EMit
EMit
><> (Fish), 5 lines, many bytes
The code is extremely long, when I say [6535529689086686142930090 '+' signs] and [6535529689086686142930090 'd' characters] in the first line of the code, I mean that there are literally 6535529689086686142930090 plus signs in a row!
(And for the following lines add the necessary prefix spaces.)
'[6535529689086686142930090 '+' signs]^`[6535529689086686142930090 'd' characters]
**,/288
-/:o
%**288:;?\
(1:\
A shorter testable alternative which only prints Hi:
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++^`hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
**,/288
-/:o
%**288:;?\
(1:\
Method:
- In the first line we create a huge number representing the string in base128.
- In the rest of the lines (going from bottom to top) we print the following character in every loop until the value of the integer reaches 0.
- The looping code is
:1(?;:882**%:o-288**,.
(We can print arbitrary 2+ chars long string with this method.)
Rebol - 15 lines (51 bytes)
PRin
AJOin
[
'Hello
Sp
+
12
Sp
'Wor
'l
'd
Sp
+
1
]
Words in Rebol are case-insensitive (eg. PRINT, Print and print would all call the same function).
The above code tidied up:
prin ajoin [
'Hello sp + 12 sp 'Wor 'l 'd sp + 1
]
NB. sp returns the space char!
Perl, 17 lines
$_
=
'pr
int
"Hello
,
Wor
l
d
!"';s
!
!!g
;s
!.
*
!$&
!eex
><>, 6 lines, 111 bytes
"""""""/;;Hello
&\o
&++\oooo~~
"++++++++\bbbdlr
+++++\ccccccccfooo}
$++66\cfffffooooopr
I'm having trouble golfing out an extra line, but in any case I'm happy to have beaten the 7-line method.
Explanation
><> is a stack-based 2D language where instructions are single chars and program flow can be up, down, left or right. The " instruction toggles string parsing, pushing chars until a closing " is met, but because of the nature of ><> there's no such thing as "multi-line string parsing" like with CJam's strings or Python's triple quoted strings. This turned out to be a major problem because starting and ending a line with a " and having other chars in between (e.g. "some chars") is not allowed!
Note that / and \ reflect program flow, so we actually execute the first line then all of the lines in reverse order, and most lines are actually executed backwards!
[Line 1]
"""""" Three empty strings, push nothing
"/;;Hello " Push "/;;Hello ". Note the wrapping - ><> is toroidal!
"""""" Three empty strings, push nothing
[Line 6]
66++$ Turn the top " " into "," by adding 12, then swap top two
rp Reverse stack and pop top 3
ooooo Print "Hello", stack is now " ,"
fffffc Push some 15s and a 12
[Line 5]
+++++ Sum the 15s and 12 to give 87, or "W"
}ooo Move "W" to the back and output ", W"
fcccccccc Push a 15 and some 12s
[Line 4]
++++++++ Sum the 15 and 12s to give 111, or "o"
"rldbbb\++++++++" Push chars to stack
r Reverse stack
ld Push length of stack and 13, not used
bbb Push three 11s
[Line 3]
++& Sum the 11s to give 33, or "!" and put in register
~~ Pop top two
oooo Print "orld"
[Line 2]
& Put "!" from register to stack
o Print "!"
[Line 1]
; Terminate
On a side note, here's an amusing attempt at a ><> least bytes (23 lines, 47 bytes):
v
"
!
d
l
r
o
W
,
o
l
l
e
H
"
/<
l
?
!
;
o
\^
Headsecks, 1 line, 366 bytes
$(((((((((((((((((((((((((((((,000000044888<AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADIIIIIIIIIIIILPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPTXXXXXXXXXXXXXXXXXXXXXXXX\```diiiiiilqqqqqqqqtyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy|
Headsecks is a trivial Brainfuck substitution where the only thing that matters is the code point modulo 8. The equivalent Brainfuck is merely
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------.
Luckily this naive approach just fits. There's some potential for golfing down bytes, but it might be hard.
Tested using this Python interpreter.
Generating code
code = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------."
command_map = "+-<>.,[]"
last_point = 32
out = []
for char in code:
curr_mod = command_map.index(char)
last_mod = last_point % 8
if curr_mod > last_mod:
last_point += curr_mod - last_mod
elif curr_mod < last_mod:
last_point += (8 - last_mod) + curr_mod
out.append(chr(last_point))
print("".join(out))
CJam, 5 4 lines, 162 bytes
"Hello
")))))))))))))))))))))))))))))))))))68S\cel
"Wor
")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))@SX\c|
Same number of lines as Insomnia! (but a lot more bytes)
Explanation
"Hello\n" Push "Hello" and a newline
) Uncons the newline
)))...))) Increment the newline into a ","
68S\ Push 68 and a space then swap, leaving 68 on top
c Convert 68 into a char "D"
el Lowercase "D" into "d"
"Wor\n" Push "Wor" and a newline
) Uncons the newline
)))...))) Increment the newline into an "l"
@ Rotate top three elements, moving the "d" to the top
SX\ Push a space and 1 then swap, leaving the space on top
c Convert the space (which is an array) into a char
| Bitwise or the space (32) with 1 to give "!" (33)
CJam automatically prints the stack afterwards.
Thanks to @Optimizer for reminding me that Sc works, because otherwise SX| fails (it does a setwise or instead, giving the array consisting of a space and 1).
Cygwin bash, 16 lines, 60 bytes
This only works due to the case-insensitive file name on Windows, and the fact that Cygwin look up the utilities case-insensitively even if you don't set it to recognize path case-insensitively.
A\
=Hello
A\
+=\
",
"Wor
A\
+=l
A\
+=d
A\
+=\
!
E\
CHO\
$A
Take note of that ECHO at the end.
Insomnia, 4 lines, 59 bytes
FFFFGjnnnnooty
FLLddeejkopqyyyyy~~
(<ddjnoppppqrtu
<<Fddfj
This program is generated by optimizing for line count.
10 lines, 43 bytes
(u
pt
(dppty
p~
j
<Fptt{
(otz
?o
FLu
<?FFu~
This above program is generated by optimizing for byte count.
///, 7 lines, 22 bytes
/
//Hello
,
Wor
l
d
!
A rare chance for /// to be competitive (well as long as no one starts with Unary and Lenguage...).
The code first encounters a /, and parses the
/
//
as a substitution instruction which removes all newlines from the remainder of the program. Afterwards, the program merely reads
Hello, World!
which is printed verbatim as it doesn't contain any further slashes.
Pyth, 7 lines, 23 bytes
-
"Hello
,
Wor
l
d
!"b
Pretty simple, just use a multiline string and remove the newlines.