

Hello World Programs in 300 Programming Languages - pawannitj
http://www.mycplus.com/featured-articles/hello-world-programs-in-300-programming-languages/

======
dewitt
One 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>

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
Interestingly 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.

------
msoad
Brainfuck was missing. Here is Hello World in brainfuck

    
    
        >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.>>>++++++++[<++++>-]
        <.>>>++++++++++[<+++++++++>-]<---.<<<<.+++.------.--------.>>+.

------
sharkweek
And it's all copyrighted by Oracle --
[http://docs.oracle.com/javase/tutorial/getStarted/applicatio...](http://docs.oracle.com/javase/tutorial/getStarted/application/examples/HelloWorldApp.java)

~~~
ysangkok
JavaDoc bug. Also prints newline.

------
stesch
The 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
I agree, here is my related take on the meaning of "hello world"
[http://www.win-vector.com/blog/2008/02/hello-world-an-
instan...](http://www.win-vector.com/blog/2008/02/hello-world-an-instance-
rhetoric-in-computer-science/)

------
postfuturist
Rosetta 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>

------
smsm42
PHP ones are wrong. Hello world in PHP is this:

Hello world!

~~~
rll
Yup, 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
No, 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

------
pschastain
A 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.

------
podperson
AS3 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.

------
pud
JavaScript example is wrong:

    
    
      <a href="#" onclick="helloWorld(); return false;">Hello World Example</a>

~~~
cwmma
none of the JavaScript ones even work in Node.js, I'd probably consider

    
    
        console.log('Hello, world!');
    

to be the closest to universal one.

~~~
beatgammit
Some 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/>

~~~
cwmma
god damn rhinoceruses fucking everything up.

------
niggler
Sad to see brainfuck missing :/

~~~
objclxt
99 Bottles is a similar, if slightly more complex, thing. Brainfuck included!

<http://www.99-bottles-of-beer.net/>

~~~
ysangkok
99 Bottles is way better because it covers iteration. FizzBuzz is even better
because 99 Bottles emphasizes string handling a bit much.

------
geldedus
actually the code for ruby is even simpler:

"Hello world"

