This is a traditional first program to write when learning a new programming language, and can be a useful [sanity test]? to make sure that a language's [development environment]? and [run-time environment]? are correctly installed.
While minimal test programs such as this existed since the development of programmable computers, the tradition of using "Hello world!" as the test message was probably started by its use as an example program in the book The C Programming Language, by Brian Kernighan and Dennis Ritchie.
Here are some examples in different languages:
with Ada.Text_Io; use Ada.Text_Io; procedure Hello is begin Put_Line ("Hello world!"); end Hello;
MODEL SMALL IDEAL STACK 100H
DATASEG HW DB 'Hello, World!$'
CODESEG MOV AX, @data MOV DS, AX MOV DX, OFFSET HW MOV AH, 09H INT 21H MOV AH, 4CH INT 21H END
PRINT "Hello world!"
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.- - - - - - - -.+++.- - - - - - . - - - - - - - - .[-]>++++++++[<++++>-]<+.[-]++++++++++.
#include <stdio.h> int main(void) { printf("Hello world!\n"); return 0; }
#include <iostream> int main() { std::cout << "Hello world!" << std::endl; return 0; }
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION. DISPLAY "Hello, World". STOP RUN.
(format t "Hello world!~%")
." Hello world!" 10 EMIT
PLEASE DO ,1 <- #13 DO ,1 SUB #1 <- #238 DO ,1 SUB #2 <- #112 DO ,1 SUB #3 <- #112 DO ,1 SUB #4 <- #0 DO ,1 SUB #5 <- #64 DO ,1 SUB #6 <- #238 DO ,1 SUB #7 <- #26 DO ,1 SUB #8 <- #248 DO ,1 SUB #9 <- #168 DO ,1 SUB #10 <- #24 DO ,1 SUB #11 <- #16 DO ,1 SUB #12 <- #158 DO ,1 SUB #13 <- #52 PLEASE READ OUT ,1 PLEASE GIVE UP
public class Hello { public static void main(String[] args) { System.out.println("Hello world!"); } }
import java.awt.*; import java.awt.event.*;
public class HelloFrame extends Frame { HelloFrame(String title) { super(title); } public void paint(Graphics g) { super.paint(g); java.awt.Insets ins = this.getInsets(); g.drawString("Hello, World!", ins.left + 25, ins.top + 25); } public static void main(String args []) { HelloFrame fr = new HelloFrame("Hello");
fr.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit( 0 ); } } ); fr.setResizable(true); fr.setSize(500, 100); fr.setVisible(true); } }
program Hello; begin writeln('Hello world!'); end.
print "Hello world!\n"
<?php echo "Hello world!\n"; ?>
Test: procedure options(main); declare My_String char(20) varying initialize('Hello, world!'); put skip list(My_String); end Test;
print "Hello world!"
print "Hello world!\n"
Transcript show: 'Hello world!'
SELECT 'Hello world!' FROM DUAL;
put "Hello world!"
Many more examples can be found at [Hello, World Page!].