As we computer programmers set out learning new languages, we almost always start with 'Hello, World!'. I know I do. It gives you that warm fuzzy feeling that only a freshly compiled program can, and it's the first step to becoming an <insert language here> ninja. Although important (superstitiously for some of us) as 'Hello, World!' is, it doesn't do much; it's one and only purpose is to print the string 'Hello, World!' to the screen (or your default output device of choice).

Some of these languages are repeats (and I'm sure some are covered in other nodes as well), but they serve to show just how similar (or how different) the 'Hello, World!' program can look from language to language. The C version, for example, is perfectly valid C++ code (compiles with both gcc and g++ anyway). Also, these versions are by no means optimized. They are either as I wrote them when I was learning the language or a reasonable facsimile thereof.

So here it is, 'Hello, World!' in every language I know (or once used and had that superstitious first program lying around taking up disk space) unless otherwise noted:

  • BASIC
    10 REM Hello, World in BASIC
    20 print "Hello, World!"
     
  • Brainfuck
    >+++++++++[<++++++++>-]<.[-]
    >++++++++++[<++++++++++>-]<+.[-]
    >+++++++++++[<++++++++++>-]<--..[-]
    >+++++++++++[<++++++++++>-]<+.[-]
    >+++++++[<++++++>-]<++.[-]
    >++++++[<+++++>-]<++.[-]
    >++++++++++[<+++++++++>-]<---.[-]
    >+++++++++++[<++++++++++>-]<+.[-]
    >+++++++++++[<++++++++++>-]<++++.[-]
    >+++++++++++[<++++++++++>-]<--.[-]
    >++++++++++[<++++++++++>-]<.[-]
    +++++++++++++.---.-
     
  • C
    /* Hello, World! in C */
    #include <stdio.h>
    int main() {
        printf("Hello, World!\n");
        return 0;
    }
     
  • C++
    // Hello, World! in C++
    #include <iostream>
    using namespace std;
    int main() {
        cout<<"Hello, World"<<endl;
        return 0;
    }
     
  • C# 1
    // Hello, World! in C#
    using System;
    namespace Hello {
        public class HelloWorld {
            static void Main() {
                Console.WriteLine("Hello, World!");
            }
        }
    }
    
     
  • COBOL
    000100 IDENTIFICATION DIVISION.
    000200 PROGRAM-ID. hello.
    000300 ENVIRONMENT DIVISION.
    000400 DATA DAVISION.
    000500 PROCEDURE DIVISION.
    000600*Hello, World! in COBOL
    000700    DISPLAY "Hello, World!".
    000800    STOP RUN
     
  • DCL
    $! Hello, World! in DCL
    $  WRITE SYS$OUTPUT "Hello, World!"
     
  • DOS batch
    REM Hello, World! in DOS batch
    @echo off
    echo Hello, World!
    echo on
     
  • FORTRAN66
    c     Hello, World in FORTRAN66
          PROGRAM HELLO_WORLD
          WRITE (*,100)
      100 FORMAT (13HHello, World!)
          END
     
  • FORTRAN77
    c     Hello, World in FORTRAN77
          PROGRAM HELLO_WORLD
          PRINT *,'Hello World'
          END
     
  • HTML
    <!-- Hello, World! in HTML -->
    <HTML>
      <HEAD>
        <TITLE>
          Hello, World!
        </TITLE>
      </HEAD>
      <BODY>
        Hello, World!
      </BODY>
    </HTML>
     
  • Java
    // Hello, World in Java
    class hello_world {
        public static void main(String args[]) {
            System.out.println("Hello, World!");
        }
    }
     
  • JavaScript
    <!-- Hello, World! in JavaScript (in HTML) -->
    <HTML>
      <HEAD>
        <TITLE>
          Hello, World!
        </TITLE>
      </HEAD>
      <BODY>
        <SCRIPT LANGUAGE="JavaScript">
          document.write("Hello, World!")
        </SCRIPT>
      </BODY>
    </HTML>
     
  • make
    # Hello, World! in make
    default:
        echo Hello, World!
     
  • O'Caml 2
    (* Hello, World! in O'Caml *)
    print_string "Hello, World!\n"
     
  • Pascal 1
    (* Hello, World! in Pascal *)
    program HelloWorld(input, output);
    begin
        writeln('Hello, World!')
    end.
     
  • Perl
    #!/usr/bin/perl
    # Hello, World! in Perl
    print "Hello, World!\n";
     
  • PHP 2
    #!/usr/bin/php -q 
    <?php
    // Hello, World! in PHP
    echo "Hello, World!\n";
    ?>
     
  • PHP (in HTML)
    <!-- Hello, World in PHP (in HTML) -->
    <HTML>
      <HEAD>
        <TITLE>
          Hello, World!
        </TITLE>
      </HEAD>
      <BODY>
        <?echo("Hello, World!");>
      </BODY>
    </HTML>
     
  • Python
    #!/usr/bin/python
    # Hello, World! in Python
    print "Hello, World!"
     
  • QBASIC
    ' Hello, World! in QBASIC
    PRINT "Hello, World!"
     
  • Unix shell 2
    #!/bin/sh
    # Hello, World! in Unix shell
    echo "Hello, World!"
     
  • VBScript (in HTML)
    <!-- Hello, World in VBScript (in HTML) -->
    <HTML>
      <HEAD>
        <TITLE>
          Hello, World!
        </TITLE>
      </HEAD>
      <BODY>
        <script language="vbscript">
          document.write("Hello, World!")
        </script>
      </BODY>
    </HTML>
     

1 - C# and Pascal programs were inspired by StrawberryFrog's writuep on both languages.
2 - O'Caml, PHP, and Unix shell programs were all given to me via a /msg (if you'd like credit, please /msg me)