# Hello World 0.0!

source: Dilbert, September 8, 1992

I'm hoping to add a new twist on the classic "Hello World!" program.

Code a program that outputs Hello World! without:

• String/Character literals
• Numbers (any base)
• Pre-built functions that return "Hello World!"
• RegEx literals

With the exceptions of "O" and 0.

†"O" is capitalized, "o" is not acceptable.

• One of [code-golf] and [code-challenge] please, not both. The point of these tags to to help people find questions with the rules they want to use. Essentially every question on this site should be a game of some kind or another. – dmckee Mar 11 '11 at 22:29
• -1 We've already had Obfuscated Hello World, and I think this challenge is too similar. I'd have cast a "close as duplicate" vote, if I weren't a mod. – Chris Jester-Young Mar 11 '11 at 22:35
• @zzzzBov: I don't think it's different enough to warrant another question in the "hello world" theme; a different theme would have been better. But, that's just my opinion. – Chris Jester-Young Mar 11 '11 at 23:39
• I think this is a fine code golf - and better than the prior one. – MtnViewMark Mar 12 '11 at 6:58
• Some people seem to assume that "O"* means they can have a string literal with any number of O’s, including zero. I don’t think that was the intention. Please clarify. – Timwi Mar 12 '11 at 21:12

# ZX Spectrum BASIC, 16 bytes

(including the end of line, but excluding the line number, since that is not part of the code itself)

The hexadecimal representation of the code is:

08 08 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0d


Its "normal" entry would be:

1\x08\x08Hello, world!


where 1 is the (unimportant) line number, \x08 means byte with the value 0x08 - you might have to overcome some slight difficulties if you want to enter it from the keyboard.

Note that Hello, world! is not a string literal, but part of the code itself.

Bonus: you do not have to RUN the program, just "having" it in the computer is enough (in keyword mode) to display:

If you accept "garbage" around the message, the code could be made shorter by three bytes.

• loophole: As "part of the code", it´s a string literal; no matter how you call it. It is also no program, not even a code snippet. It´s actually just plain text. – Titus Jan 28 '17 at 12:33
• @Titus No, it most definitely is not a string literal - in ZX Spectrum BASIC there is a very sharp difference between code and literals - numbers and strings (also in how they are represented in RAM). And this is none of them, it's neither a string variable. – Radovan Garabík Jan 28 '17 at 13:47

# PHP, 160 157 bytes

no literals at all. Still wonder if it has golfing potential left:

for(;$c=[$h=($f=($t=++$n+$n)+$t)+$f+$s=$f*$f*$f,$e=$s+$s/$t+$v=$f+$n--,$l=$e+$f+--$f,$l,$o=$l+$f,$s/=$t,$h+$v*$f,$o,$o+$f,$l,--$e,++$s][+$i++];)echo chr($c);


creates an array with the ascii codes and loops through it to print the characters.
Run with -nr or try it online.

breakdown

for(;$c=[$h=
($f=($t=++$n+$n)+$t) #$n=1,$t=2,$f=4
+$f+$s=$f*$f*$f, # H$s=64,$h=72$e=$s+$s/$t+$v=$f+$n--, # e     $n=0,$v=5,$e=101$l=$e+$f+--$f,$l,       # ll    $f=3,$l=108
$o=$l+$f, # o$o=111
$s/=$t,                 # space $s=32$h+$v*$f,$o, # Wo$o+$f,$l,               # rl
--$e, # d$e=100
++$s # !$s=33
][+$i++];) # loop through array echo chr($c);           # print character


## F#, 103 bytes

let[<EntryPoint>]Hello world!a=System.Reflection.MethodBase.GetCurrentMethod().Name|>stdout.Write;0


Similar to some of the other answers here. The  characters around the method name are not literals, rather they "delimit an identifier that would otherwise not be a legal identifier, such as a language keyword." (Source)

They do make F# nice for writing tests, since you can give a long human-language name for the tests instead of a programming-language name.

# Forth (gforth), 38 bytes

: f name type ; f Hello space f World!


Try it online!

OR

name World! name Hello type space type


Try it online!

### Explanation

Uses the Forth built-in for processing code to convert the next character entered to a string, and then prints it

### Code Explanation

: f             \ start a new word definition
name          \ grabs the next word (space-delimited) from the input/code
type          \ output the string on top of the stack
;               \ end word definition
f Hello         \ converts and outputs Hello, as name will grab Hello from the input before continuing
space           \ outputs a single space
f World!        \ converts World! to a string and outputs it


# JavaScript, 166 bytes

(o=-~0,O=o+[],e=O+0,c=e+0,q=O+c,d=c+0,p=e+O+O+O)=>[c+d,q+e+O,a=O+e+q,a,g=O+p+O,d+0+0,e+p,g,O+q+e,a,q+c,d+0+O].map(b=>String.fromCharCode(parseInt(b,o+o))).join([]+[])


I tried to use most circular alphabet as possible for the variable names.

# Runic Enchantments, 94 bytes

mmXm-m-FFm-k$Xm+mm,+:m-:k$Fm+k::}::,:++k:}$mKymmmm+++k$mmqnmm,-k${${:FFm+k$k$Fmm+Xk$FFmmqnk@  Try it online! Wouldn't surprise me if there's a shortcut or two I missed to construct the required values in fewer bytes (mmmm+++ is particularly gross), but managing the stack with duplicated values to be used later incurs its own overhead (as does adjusting the IP s mana value). As such only the o and l in World are utilized this way, as they are constructed in the order lo and required again later in the order ol, so only 6 total bytes are needed to dup and rotate. The program functions by drawing on the inherent mana of the instruction pointer to generate numerical values, then performing arithmetic operations on that value as necessary to generate the decimal values 72, 101, 108, 111, 32, 87, 114, 100 in order, casting each to char and printing them. m -> push current mana value to stack (default 10) F -> lower mana value by 1 ("Fizzle") mK -> increase mana value by 1 (spawns an IP with m mana, costs m-1, then they combine) X -> multiply top of stack by 10 (note that this is not a literal value) k -> cast top of stack to Char$  -> print top of stack


In this way the sequence mXm-m- gives the value 80. FFm gives the value 8. 80 - 8 = 72:
mXm-m-FFm-k\$ causes H to be printed.

C# (357)

class H
{
static void main()
{
Func<ConsoleKey, char> f = (k) => (char) k;
Func<char, char> l = (c) => char.ToLower(c);

Console.WriteLine(new[] {
f(ConsoleKey.H),
l(f(ConsoleKey.E)),
l(f(ConsoleKey.L)),
l(f(ConsoleKey.L)),
l(f(ConsoleKey.O)),
f(ConsoleKey.Spacebar),
f(ConsoleKey.W),
l(f(ConsoleKey.O)),
l(f(ConsoleKey.R)),
l(f(ConsoleKey.L)),
l(f(ConsoleKey.D)),
f(ConsoleKey.PageUp)
});
}
}


Golfed:

class H{static void main(){Func<ConsoleKey,char>f=(k)=>(char)k;Func<char,char>l=(c)=>char.ToLower(c);Console.WriteLine(new[]{f(ConsoleKey.H),l(f(ConsoleKey.E)),l(f(ConsoleKey.L)),l(f(ConsoleKey.L)),l(f(ConsoleKey.O)),f(ConsoleKey.Spacebar),f(ConsoleKey.W),l(f(ConsoleKey.O)),l(f(ConsoleKey.R)),l(f(ConsoleKey.L)),l(f(ConsoleKey.D)),f(ConsoleKey.PageUp)});}}

• using C = System.ConsoleKey; would save a number of chars. – zzzzBov Jan 28 '14 at 22:55
• I don't think it will. Enum constants can only be referred through Enum. – microbian Jan 28 '14 at 23:02
• Next time, please compile your programs before posting them. This needs a using System and Main needs to be capitalized. However, the suggestion made by @zzzzBov is correct; you can use using C=System.ConsoleKey; to abbreviate the code massively. Furthermore, you can remove the parentheses around the lambda parameters. That takes it down to 275. – Timwi Feb 5 '14 at 0:48

# Ruby 49 chars

def Hello World!;puts __method__;end
Hello World!


The whitespace in the method name is a UTF8 Emsp, a little wider then a normal space which would be a syntax error.

# Stuck, 0 bytes

Yup, an empty program in stuck prints Hello, World! I don't see any string literals or Regex here

• standard loophole – zzzzBov Jan 22 '17 at 7:01
• Ok, let me start by explaining that I am the original poster of this challenge, so whatever I tell you can be considered "word of god" for this challenge. I'll follow that with the fact that I posted this challenge almost six years ago, and I was much less experienced. Finally, per the FAQ "The purpose of this question is to provide a repository of standard loopholes which may be assumed to be closed without the question-setter having to explicitly close them." -- with all of that said, they are absolutely forbidden for this challenge. – zzzzBov Jan 28 '17 at 16:58

# Windows Batch (17)

echo Hello World!

• Does Hello World! not qualify as a string literal here? Curious. – shadowtalker Jul 7 '14 at 22:11