6 ms·
Hello World Programs in 300 Programming Languages
- niggler 14y agoSad to see brainfuck missing :/
- objclxt 14y ago99 Bottles is a similar, if slightly more complex, thing. Brainfuck included! http://www.99-bottles-of-beer.net/ http://www.99-bottles-of-beer.net/
- beatgammit 14y agoBut it has 1500 different programming languages, which is FAR more impressive (whitespace included =D)
- ysangkok 14y ago99 Bottles is way better because it covers iteration. FizzBuzz is even better because 99 Bottles emphasizes string handling a bit much.
- co_pl_te 14y agoThis was my first reaction, too! ;-) Here's Wikipedia's example 'Hello, World!' program: http://en.wikipedia.org/wiki/Brainfuck#Hello_World.21 http://en.wikipedia.org/wiki/Brainfuck#Hello_World.21
- sharkweek 14y agoAnd it's all copyrighted by Oracle -- http://docs.oracle.com/javase/tutorial/getStarted/application/examples/HelloWorldApp.java http://docs.oracle.com/javase/tutorial/getStarted/applicatio...
- ysangkok 14y agoJavaDoc bug. Also prints newline.
- dewitt 14y agoOne of the more popular sites of this nature is rosettacode.org, which in their own words, "is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another." For example: http://rosettacode.org/wiki/Hello_World http://rosettacode.org/wiki/Hello_World Plus, I enjoyed learning the word "chrestomathy", which "from the Greek words khrestos, useful, and mathein, to know, is a collection of choice literary passages, used especially as an aid in learning a subject."
- smsm42 14y agoInterestingly enough, I think this is the first time I see this word used in English, though in Russian it is pretty common (unsurprisingly, used in the same context). In fact, Google has 10 times more results for Russian one than for the English one.
- stesch 14y agoThe intention behind "Hello, world!" was to show the steps you need to run your code. In C's case: compiling it. These examples just show some silly code, without any further information. It would be really interesting to see how some languages deploy.
- jmount 14y agoI agree, here is my related take on the meaning of "hello world" http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/ http://www.win-vector.com/blog/2008/02/hello-world-an-instan...
- pschastain 14y agoA bit off-topic, but the site locks up Chrome on Snow Leopard and causes one my cores to peak, and I'm forced to eventually kill the tab. Firefox has no problems. Any ideas why that might be? Otherwise, a fun read-through.
- pud 14y agoJavaScript example is wrong: <a href="#" onclick="helloWorld(); return false;">Hello World Example</a>
- cwmma 14y agonone of the JavaScript ones even work in Node.js, I'd probably consider console.log('Hello, world!'); to be the closest to universal one.
- deleted 14y ago[deleted]
- beatgammit 14y agoSome implementations don't define console, so this wouldn't work in some (for example, Rhino). Something like this would be more universal: if (typeof console === 'object') { console.log('Hello, World!'); } else if (typeof document === 'object') { document.write('Hello, World!'); } else { print('Hello, World!'); } http://progopedia.com/implementation/rhino/ http://progopedia.com/implementation/rhino/
- cwmma 14y agogod damn rhinoceruses fucking everything up.
- msoad 14y agoBrainfuck was missing. Here is Hello World in brainfuck >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.>>>++++++++[<++++>-] <.>>>++++++++++[<+++++++++>-]<---.<<<<.+++.------.--------.>>+.
- smsm42 14y agoPHP ones are wrong. Hello world in PHP is this: Hello world!
- rll 14y agoYup, people often miss that PHP is modal and that the default mode is simply to output. So if you put Hello World in a file it actually compiles to these opcodes: ECHO 'Hello+World%0A' RETURN 1 Which is identical to the opcodes produced by putting <?php echo "Hello World"; ?> into a file.
- ysangkok 14y agoNo, it's not identical. $ echo -n "<?php echo 'Hello World'; ?>" > hello.php $ php -d vld.active=1 -d vld.execute=0 -f hello.php line # * op fetch ext return operands --------------------------------------------------------------------------------- 1 0 > ECHO 'Hello+World' 1 > RETURN 1 $ echo -n "Hello World" > hello.php $ php -d vld.active=1 -d vld.execute=0 -f hello.php 1 0 > ECHO 'Hello+World' 1 > RETURN 1 $ echo "<?php echo 'Hello World'; ?>" > hello.php $ php -d vld.active=1 -d vld.execute=0 -f hello.php 1 0 > ECHO 'Hello+World' 2 1 > RETURN 1 $ echo "Hello World" > hello.php $ php -d vld.active=1 -d vld.execute=0 -f hello.php 2 0 > ECHO 'Hello+World%0A' 1 > RETURN 1 PHP 5.3.10-1ubuntu3.6 / Zend Engine v2.3.0 / vld-0.11.2
- postfuturist 14y agoRosetta Code has Hello World in only 245 programming languages (but a huge corpus of other examples in various languages). http://rosettacode.org/wiki/Hello_world http://rosettacode.org/wiki/Hello_world
- geldedus 14y agoactually the code for ruby is even simpler: "Hello world"
- podperson 14y agoAS3 example creates class with a method but doesn't call the method. Also it subclasses a sprite but then uses trace (console log). Fractally bad.