Hello world

From CodeCodex

Implementations[edit]

Ada[edit]

with Ada.Text_IO;

procedure Hello is
begin
   Ada.Text_IO.Put_Line("Hello World!");
end Hello;

Algol 68[edit]

print(("Hello, World!", new line))

ASP[edit]

<% Response.Write("Hello World!") %>

x86 Assembler[edit]

Turbo Assembler, Windows[edit]

    .model tiny

    .data
message    db    'Hello, World!'
    
    .code
    org 100h

start:
    mov ah,9
    mov dx,offset message
    int 21h

    ret
    end start

Netwide Assember, GNU/Linux[edit]

section .text
global _start
_start:
	mov	edx, msglen
	mov	ecx, msg
	mov	ebx, 0x1
	mov	eax, 0x4
	int	0x80

	mov	ebx, 0x0
	mov	eax, 0x1
	int	0x80

section .data
	msg	db	"Hello, world!", 0xa
	msglen	equ	$ - len

BASIC[edit]

print "Hello World!"

C[edit]

#include <stdio.h>

int main(void)
{
    printf("Hello, World!\n");
    return 0;
}

C++[edit]

#include <iostream>

int main()
{
    std::cout << "Hello, World!" << std::endl;
}

OR

#include <iostream>
using namespace std;

int main()
{
    cout << "Hello, World!" << endl;
}

C#[edit]

using System;

public class HelloWorld
{
    public static void Main()
        {
            System.Console.WriteLine("Hello World!");
        }
}

Common Lisp[edit]

(write-line "Hello, World!\n")

..or..

(defun main ()
  (write-line "Hello, World!")
  0)

Erlang[edit]

io:fwrite("Hello, World!~n").

Fortran[edit]

PROGRAM HelloWorld
WRITE(*,*)"Hello, World!"
END PROGRAM

Go[edit]

package main
import "fmt"
func main() {
  fmt.Println("Hello, World!")
}

Groovy[edit]

println("Hello World!");

or

println "Hello World!"

Haskell[edit]

main = putStrLn "Hello World!"

Io[edit]

"Hello, world!" println

Java[edit]

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

Alternatively:

class HelloWorld
{  
        static
        {
           System.out.println("Hello World!");
           System.exit(0); // exit before the JVM tries to run non-existent main()
        }
}

LOLCODE[edit]

 HAI
 CAN HAS STDIO?
 VISIBLE "HAI WORLD!"
 KTHXBYE

Lua[edit]

print "Hello, world!"

OCaml[edit]

 # print_endline "Hello world!";;
 Hello world!
 - : unit = ()

Pascal[edit]

program HelloWorld;

begin
   writeln('Hello, world!');
end.

Perl[edit]

print "Hello World\n";

As PL File[edit]

print "Hello World\n";

As CGI File[edit]

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "<H1>Hello World</H1>";

PHP[edit]

<?php
echo "Hello, world!\n";
?>

PostScript[edit]

The strict equivalent to the other languages (print a string to standard output) would be:

(Hello, World!) =

However, this is not typical of how PostScript is normally used, to generate and print page images.

The following version prints a page with the "Hello, World!" message.

/Helvetica findfont % use a standard font
72 scalefont setfont % make it nice and big
100 100 moveto % someplace convenient on the page
(Hello, World!) show
showpage

Progress 4GL/ABL[edit]

display "Hello World!".

Python[edit]

print "Hello, World!"

Rexx[edit]

/* */
say "Hello, World!"

Ruby[edit]

puts "Hello, World!"

# OR
p "Hello, World!"

# OR
print "Hello, World!\n"

Scheme[edit]

(display "Hello, world!")

Seed7[edit]

$ include "seed7_05.s7i";
 
const proc: main is func
  begin
    writeln("Hello, world!");
  end func;

Tcl[edit]

puts "Hello, World!"

Turing[edit]

put "Hello, World!"

Visual Basic[edit]

Console.WriteLine("Hello, World!")

XQuery[edit]

"Hello World"

Zsh[edit]

Three forms

echo "Hello, World\!"
print "Hello, World\!"
printf "Hello, World\!\012"