Take the 2-minute tour ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

Produce a text file that prints "Hello World!" in as many programming languages as possible when compiled/interpreted, while also being as short as possible.

The score for your submission is calculated as C / 2 ^ ((L - 1) / 4), where "C" is the length of the text file in characters and "L" is the number of languages that the program is valid in. Lowest score wins, of course.

share|improve this question
1  
This question is similar to this other one, but in this case, you can share "Hello World" among some languages if you wish. –  Joe Z. Feb 15 '13 at 18:52

3 Answers 3

up vote 9 down vote accepted
print("Hello World!")

Works in at least Julia, Perl, PHP, Python2, Python3, Qbasic, R, Ruby ...

share|improve this answer
1  
It also works in R and Julia (and surely in many other languages). –  Sven Hohenstein Feb 19 '13 at 7:20
    
works in PHP too –  jdstankosky Mar 8 '13 at 14:39
    
This print() syntax is also valid in Transact-SQL. pastebin.com/is2mqRJC –  manatwork Mar 9 '13 at 16:03
1  
Kind of forcing the limits, but we can say it works in JavaScript too, as some command line interpreters provide print() function for outputting. pastebin.com/6fXtgFER –  manatwork Mar 9 '13 at 18:14
1  
works in lua too –  mniip Dec 31 '13 at 1:54
'Hello World!'

Runs in several scripting languages, including PHP, GolfScript, APL, ...

share|improve this answer
    
Also AppleScript and Javascript :) –  tomsmeding Feb 21 '13 at 19:03
    
Won't Javascript include the quotes? –  Joe Z. Feb 22 '13 at 4:18
    
This works in PowerShell too. –  Iszi Nov 22 '13 at 20:51

Score of 0.84

H

Works in H9+ and HQ9+.

1 / 2 ^ ((2 - 1) / 4) = 0.84

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.