Fork me on GitHub

Codes Demo

Hello World program sources from Wikipedia: List of Hello world program examples.

Ada

with Ada.Text_IO;

procedure Hello_World is
 use Ada.Text_IO;
begin
    Put_Line("Hello, world!");
end;

C

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("Hello, world!\n");

    return 0;
}

C++

#include <iostream>
using namespace std;
int main()
{
    cout << "Hello, world!" << endl;
    return 0;
}

HTML

<!DOCTYPE html>
<html>
<body>
Hello, world!
</body>
</html>

Java

public class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello, world!");
   }
}

JavaScript

To write to an HTML document:

document.write("Hello, world!");

To display an alert dialog box:

alert("Hello, world!");

To write to a console/debugging log:

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

Using Mozilla's Rhino:

print("Hello, world!");

Using Windows Script Host:

WScript.Echo("Hello, world!");

Python

Python 2

print "Hello, world!"

Python 3

print("Hello, world!")

Ruby

puts "Hello, world!"

Shell

echo "Hello, world!"

SQL

SELECT "Hello, world!" FROM DUMMY; -- DUMMY is a standard table in SAP HANA.
SELECT "Hello, world!" FROM DUAL; -- DUAL is a standard table in Oracle.
SELECT "Hello, world!" -- This will work in SQL Server.

Comments