IT Updates: List of hello world programs

The following is a list of Hello, world! programs.

Hello, world! programs make the text “Hello, world!” appear on a computer screen. It is usually the first program encountered when learning a programming language. Otherwise, it’s a basic sanity check for an installation of a new programming language. If “Hello World” won’t run, one must not try and develop complex programs before fixing the issues with the installation.

4DOS batch

It should be noted that the 4DOS/4NT batch language is a superset of the MS-DOS batch language.

 @echo Hello, world!

[edit] Ingres 4GL

message "Hello, world!" with style = popup;

[edit] ABAP – SAP AG

REPORT ZELLO.
WRITE 'Hello, world!'.

[edit] ABC

WRITE "Hello, world!"

[edit] ActionScript 1.0 and 2.0

This will output to the output window only, which an end user would not see.

trace("Hello, world!");

This version will be visible to the end user. Use of _root to clarify scope only.

var helloWorld:TextField = _root.createTextField( "helloWorld", _root.getNextHighestDepth(), 1, 1, 100, 20 );
helloWorld.text = "Hello, world!";

[edit] ActionScript 3

package
{
    import flash.display.Sprite;
    public class HelloWorld extends Sprite
    {
        public function HelloWorld()
        {
            trace("Hello, world!");
        }
    }
}

[edit] Ada

with TEXT_IO;
 
procedure HELLO is
begin
    TEXT_IO.PUT_LINE ("Hello, world!");
end HELLO;

For explanation see Ada Programming:Basic.

[edit] ALGOL 68

In the popular upper-case stropping convention for bold words:

BEGIN
    printf($"Hello, world!"l$)
END

or using prime stropping suitable for punch cards on 6 bit character platforms:

'BEGIN'
    PRINTF($"HELLO, WORLD!"l$)
'END'

or minimally using the “brief symbol” form of begin and end.

( printf($"Hello, world!"l$) )

[edit] AmigaE

PROC main()
   WriteF('Hello, world!');
ENDPROC

[edit] AMX NetLinx

This program sends the message out via the Diagnostics Interface after start-up.

program_name = 'Hello'
define_start
send_string 0,'Hello World!'

[edit] APL

An explicit return function for the Hello, world! program may be coded as follows (note: TeX fonts are not correct)

    \nabla  \mathrm {R} \leftarrow \mathrm {HW} \Delta\mathrm{PGM}  
\left [ 1 \right ] \mathrm {R}\leftarrow \mathrm {'HELLO} \; \mathrm {WORLD!'} 
    \nabla 
  • The Del on the first line begins function definition for the program named HWΔPGM. It is a niladic function (no parameters, as opposed to monadic or dyadic) and it will return an explicit result which allows other functions or APL primitives to use the returned value as input.
  • The line labelled 1 assigns the text vector ‘Hello, world!’ to the variable R
  • The last line is another Del which ends the function definition.

When the function is executed by typing its name, the APL interpreter assigns the text vector to the variable R, but since we have not used this value in another function, primitive, or assignment statement the interpreter returns it to the terminal, thus displaying the words on the next line below the function invocation.

The session would look like this

      HWΔPGM
Hello, world!

While not a program, if you simply supplied the text vector to the interpreter but did not assign it to a variable it would return it to the terminal as output. Note that user input is automatically indented 6 spaces by the interpreter while results are displayed at the beginning of a new line.

      'Hello, world!'
Hello, world!

[edit] AppleScript

See also GUI section.

return "Hello, world!"

[edit] ASP

<% Response.Write("Hello, world!") %>
or simply:
<%= "Hello, world!" %>

[edit] ASP.NET

// in the code behind using C#
protected void Page_Load(object sender, EventArgs e)
{
  Response.Write("Hello, world!");
}
// ASPX Page Template
 
<asp:Literal ID="Literal1" runat="server" Text="Hello World!"></asp:Literal>

or

<asp:Label ID="Label1" runat="server" Text="Hello World"></asp:Label>

or

Hello World!

[edit] Assembly language

[edit] Accumulator-only architecture: DEC PDP-8, PAL-III assembler

See the example section of the PDP-8 article.

[edit] First successful uP/OS combinations: Intel 8080/Zilog Z80, CP/M, RMAC assembler

bdos    equ    0005H    ; BDOS entry point
start:  mvi    c,9      ; BDOS function: output string
        lxi    d,msg$   ; address of msg
        call   bdos
        ret             ; return to CCP

msg$:   db    'Hello, world!$'
end     start

[edit] Popular home computer: ZX Spectrum, Zilog Z80, HiSoft GENS assembler

 10          ORG #8000    ; Start address of the routine
 20 START    LD A,2       ; set the output channel
 30          CALL #1601   ; to channel 2 (main part of TV display)
 40          LD HL,MSG    ; Set HL register pair to address of the message
 50 LOOP     LD A,(HL)    ; De-reference HL and store in A
 60          CP 0         ; Null terminator?
 70          RET Z        ; If so, return
 80          RST #10      ; Print the character in A
 90          INC HL       ; HL points at the next char to be printed
100          JR LOOP
110 MSG      DEFM "Hello, world!"
120          DEFB 13      ; carriage return
130          DEFB 0       ; null terminator

[edit] Accumulator + index register machine: MOS Technology 6502, CBM KERNEL, MOS assembler syntax

A_CR  = $0D              ;carriage return
BSOUT = $FFD2            ;kernel ROM sub, write to current output device
;
        LDX #$00         ;starting index in .X register
; 
LOOP    LDA MSG,X        ;read message text
        BEQ LOOPEND      ;end of text
;
        JSR BSOUT        ;output char
        INX
        BNE LOOP         ;repeat
;
LOOPEND RTS              ;return from subroutine
;
MSG     .BYT 'Hello, world!',A_CR,$00

[edit] Accumulator/Index microcoded machine: Data General Nova, RDOS

See the example section of the Nova article.

[edit] Expanded accumulator machine: Intel x86, DOS, TASM

MODEL   SMALL
IDEAL
STACK   100H

DATASEG
        MSG DB 'Hello, world!', 13, '$'

CODESEG
Start:
        MOV AX, @data
        MOV DS, AX
        MOV DX, OFFSET MSG
        MOV AH, 09H      ; DOS: output ASCII$ string
        INT 21H
        MOV AX, 4C00H
        INT 21H
END Start

[edit] ASSEMBLER x86 (DOS, MASM)

.MODEL Small
.STACK 100h
.DATA
   db msg 'Hello, world!$'
.CODE
start:
   mov ah, 09h
   lea dx, msg ; or mov dx, offset msg
   int 21h
   mov ax,4C00h
   int 21h
end start

[edit] ASSEMBLER x86 (DOS, FASM)

; FASM example of writing 16-bit DOS .COM program
; Compile: "FASM HELLO.ASM HELLO.COM" 
  org  $100
  use16    
  mov  ah,9
  mov  dx,xhello
  int  $21    ; DOS call: text output
  mov  ah,$4C
  int  $21    ; Return to DOS
xhello db 'Hello world !!!$'

[edit] Expanded accumulator machine: Intel x86, Microsoft Windows, FASM

Example of making 32-bit PE program as raw code and data:

 
 format PE GUI
 entry start
 
 section '.code' code readable executable
 
     start:
 
         push   0
         push   _caption
         push   _message
         push   0
         call   [MessageBox]
 
         push   0
         call   [ExitProcess]
 
 section '.data' data readable writeable
 
   _caption db 'Win32 assembly program',0
   _message db 'Hello, world!',0
 
 section '.idata' import data readable writeable
 
   dd 0,0,0,RVA kernel_name,RVA kernel_table
   dd 0,0,0,RVA user_name,RVA user_table
   dd 0,0,0,0,0
 
  kernel_table:
     ExitProcess dd RVA _ExitProcess
     dd 0
  user_table:
     MessageBox dd RVA _MessageBoxA
     dd 0
 
  kernel_name db 'KERNEL32.DLL',0
  user_name db 'USER32.DLL',0

  _ExitProcess dw 0
     db 'ExitProcess',0
  _MessageBoxA dw 0
     db 'MessageBoxA',0
 
 section '.reloc' fixups data readable discardable

[edit] Expanded accumulator machine: Intel x86, Linux, FASM

 format ELF executable
 entry _start
 
 _start:
      mov eax, 4
      mov ebx, 1
      mov ecx, msg
      mov edx, msg_len
      int 0x80
 
      msg db 'Hello, world!', 0xA
      msg_len = $-msg

[edit] Expanded accumulator machine:Intel x86, Linux, GAS

.data
msg:
    .ascii     "Hello, world!\n"
    len = . - msg
.text
    .global _start
_start:
    movl $len,%edx
    movl $msg,%ecx
    movl $1,%ebx
    movl $4,%eax
    int $0x80
    movl $0,%ebx
    movl $1,%eax
    int $0x80

[edit] Expanded accumulator machine: Intel x86, Linux, NASM

    section .data
msg     db      'Hello, world!',0xA
len     equ     $-msg

    section .text
global  _start
_start:
        mov     edx,len
        mov     ecx,msg
        mov     ebx,1
        mov     eax,4
        int     0x80

        mov     ebx,0
        mov     eax,1
        int     0x80

[edit] Expanded accumulator machine: Intel x86, Linux, GLibC, NASM

extern printf ; Request symbol "printf".
global main   ; Declare symbol "main".

section .data
  str: DB "Hello World!", 0x0A, 0x00

section .text
main:
  PUSH str    ; Push string pointer onto stack.
  CALL printf ; Call printf.
  POP eax     ; Remove value from stack.
  MOV eax,0x0 ; \_Return value 0.
  RET         ; /

[edit] General-purpose fictional computer: MIX, MIXAL

TERM    EQU    19          console device no. (19 = typewriter)
        ORIG   1000        start address
START   OUT    MSG(TERM)   output data at address MSG
        HLT                halt execution
MSG     ALF    "HELLO"
        ALF    " WORL"
        ALF    "D    "
        END    START       end of program

[edit] General-purpose fictional computer: MMIX, MMIXAL

string  BYTE   "Hello, world!",#a,0   string to be printed (#a is newline and 0 terminates the string)
  Main  GETA   $255,string            get the address of the string in register 255
        TRAP   0,Fputs,StdOut         put the string pointed to by register 255 to file StdOut
        TRAP   0,Halt,0               end process

[edit] General-purpose-register CISC: DEC PDP-11

[edit] RT-11, MACRO-11
        .MCALL  .REGDEF,.TTYOUT,.EXIT
        .REGDEF

HELLO:  MOV    #MSG,R1
        MOVB   (R1)+,R0
LOOP:  .TTYOUT
        MOVB   (R1)+,R0
        BNE    LOOP
       .EXIT

MSG:   .ASCIZ  /Hello, world!/
       .END    HELLO
[edit] Variant for Elektronika BK using BIOS function, MICRO-11
        MOV     #TXT,R1              ;Moving string address to R1
        CLR     R2                   ;String length=0, means null will be the termination character
        EMT     20                   ;Print the string
        HALT

TXT:    .ASCIZ  /Hello, world!/
        .END

[edit] CISC Amiga (Workbench 2.0): Motorola 68000

        include lvo/exec_lib.i
        include lvo/dos_lib.i

        ; open DOS library
        movea.l  4.w,a6
        lea      dosname(pc),a1
        moveq    #36,d0
        jsr      _LVOOpenLibrary(a6)
        movea.l  d0,a6

        ; actual print string
        lea      hellostr(pc),a0
        move.l   a0,d1
        jsr      _LVOPutStr(a6)

        ; close DOS library
        movea.l  a6,a1
        movea.l  4.w,a6
        jsr      _LVOCloseLibrary(a6)
        rts

dosname     dc.b 'dos.library',0
hellostr    dc.b 'Hello, world!',0

[edit] CISC Atari: Motorola 68000

;print
     move.l   #Hello,-(A7)
     move.w   #9,-(A7)
     trap     #1
     addq.l   #6,A7

;wait for key
     move.w   #1,-(A7)
     trap     #1
     addq.l   #2,A7

;exit
     clr.w   -(A7)
     trap    #1
 
Hello
     dc.b    'Hello, world!',0

[edit] CISC on advanced multiprocessing OS: DEC VAX, VMS, MACRO-32

        .title    hello

        .psect    data, wrt, noexe

chan:   .blkw     1
iosb:   .blkq     1
term:   .ascid    "SYS$OUTPUT"
msg:    .ascii    "Hello, world!"
len =   . - msg

        .psect    code, nowrt, exe

        .entry    hello, ^m<>

        ; Establish a channel for terminal I/O
        $assign_s devnam=term, -
                  chan=chan
        blbc      r0, end

        ; Queue the I/O request
        $qiow_s   chan=chan, -
                  func=#io$_writevblk, -
                  iosb=iosb, -
                  p1=msg, -
                  p2=#len

        ; Check the status and the IOSB status
        blbc      r0, end
        movzwl    iosb, r0

        ; Return to operating system
end:    ret

       .end       hello

[edit] Mainframe: IBM z/Architecture series using BAL

HELLO    CSECT               The name of this program is 'HELLO'
         USING *,12          Tell assembler what register we are using
         SAVE (14,12)        Save registers
         LR    12,15         Use Register 12 for this program  
         WTO   'Hello, world!' Write To Operator
         RETURN (14,12)      Return to calling party
         END  HELLO          This is the end of the program           

[edit] RISC processor: ARM, RISC OS, BBC BASIC’s in-line assembler

.program         
         ADR R0,message
         SWI "OS_Write0"
         SWI "OS_Exit"
.message         
         DCS "Hello, world!"
         DCB 0
          ALIGN

or the even smaller version (from qUE);

         SWI"OS_WriteS":EQUS"Hello, world!":EQUB0:ALIGN:MOVPC,R14

[edit] RISC processor: MIPS architecture

         .data
msg:     .asciiz "Hello, world!"
         .align 2
         .text
         .globl main      
main:
         la $a0,msg
         li $v0,4
         syscall
         jr $ra

[edit] RISC processor: PowerPC, Mac OS X, GAS

.data
msg:
    .ascii "Hello, world!\n"
    len = . - msg

.text
    .globl _main

_main:
    li r0, 4 ; write
    li r3, 1 ; stdout
    addis r4, 0, ha16(msg) ; high 16 bits of address
    addi r4, r4, lo16(msg) ; low 16 bits of address
    li r5, len ; length
    sc

    li r0, 1 ; exit
    li r3, 0 ; exit status
    sc

[edit] Sigma 6/7/8/9 METASYMBOL

       SYSTEM   BPM
START  M:PRINT (MESS,HW)
       M:EXIT
HW     TEXTC    'HELLO WORLD'
       END      START

[edit] AutoHotkey

MsgBox, Hello, world!

[edit] AutoIt

MsgBox(0,'','Hello, world!')

[edit] Avenue – Scripting language for ArcView GIS

MsgBox("Hello, world!","aTitle")

[edit] AWK

BEGIN { print "Hello, world!" }

[edit] B

This is the first known Hello, world! program ever written:[1]

main( ) {
  extrn a, b, c;
  putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';

[edit] Baan Tools

Also known as Triton Tools on older versions. On Baan ERP you can create a program on 3GL or 4GL mode.

Baan Tools on 3GL Format:

function main()
{
    message("Hello, world!")
}

Baan Tools on 4GL Format:

choice.cont.process:
on.choice:
    message("Hello, world!")

On this last case you should press the Continue button to show the message.

[edit] Ball

Most basic form–

write Hello, *s world *n

[edit] Bash or sh

See also UNIX-style shell.

echo 'Hello, world!'

or

printf 'Hello, world!\n'

or using the C preprocessor

#!/bin/bash
#define cpp #
cpp $0 2> /dev/null | /bin/bash; exit $?
#undef cpp
#define HELLO_WORLD echo "hello, world"
HELLO_WORLD | tr a-z A-Z

[edit] BASIC

[edit] General

The following example works for any ANSI/ISO-compliant BASIC implementation, as well as most implementations built into or distributed with microcomputers in the 1970s and 1980s (usually some variant of Microsoft BASIC):

10 PRINT "Hello, world!"
20 END

Note that the “END” statement is optional in many implementations of BASIC.

Some implementations could also execute instructions in an immediate mode when line numbers are omitted. The following examples work without requiring a RUN instruction.

PRINT "Hello, world!"
? "Hello, world!"

Later implementations of BASIC allowed greater support for structured programming and did not require line numbers for source code. The following example works when RUN for the vast majority of modern BASICs.

PRINT "Hello, world!"
END

Again, the “END” statement is optional in many BASICs.

[edit] BlitzBasic

Print "Hello, world!"
WaitKey

[edit] DarkBASIC

PRINT "Hello, world!"
`or
TEXT 0,0,"Hello, world!"
WAIT KEY

Note: In the “classic” Dark Basic the WAIT KEY command is optional as the console goes up when the program has finished.

[edit] Liberty BASIC

To write to the main window:

print "Hello, world" 

Or drawn in a graphics window:

nomainwin
open "Hello, world!" for graphics as #main
print #main, "place 50 50"
print #main, "\Hello, world!"
print #main, "flush"
wait

[edit] Microsoft Small Basic

TextWindow.WriteLine("Hello, world!")

[edit] PBASIC

DEBUG "Hello, world!", CR

or, the typical microcontroller Hello, world! program equivalent with the only output device present being a light-emitting diode (LED) (in this case attached to the seventh output pin):

DO
    HIGH 7 'Make the 7th pin go high (turn the LED on)
    PAUSE 500 'Sleep for half a second
    LOW 7 ' Make the 7th pin go low (turn the LED off)
    PAUSE 500 'Sleep for half a second
LOOP
END

[edit] StarOffice/OpenOffice Basic

sub main
    print "Hello, world!"
end sub

[edit] PureBasic

OpenConsole()
PrintN("Hello, world!")
Input()

or

 MessageRequester("Hello, World","Hello, World")

or

 Debug "Hello, World"

[edit] TI-BASIC

On TI calculators of the TI-80 through TI-86 range:

:Disp "Hello, world!          (note the optional ending quotes) or
:"Hello, world!               (only works if on last line of program) or
:Output(X,Y,"Hello, world!    or
:Text(X,Y,"Hello, world!      (writes to the graph rather than home screen) or
:Text(-1,X,Y,"Hello, world!   (only on the 83+ and higher, provides larger text, home screen size)

Note: “!” character is not on the keypad. It can be accessed from “Catalog” or the “Probability” menu (as factorial notation).

On TI-89/TI-89 Titanium/TI-92(+)/Voyage 200 calculators:

:hellowld()
:Prgm
:Disp "Hello, world!"
:EndPrgm

[edit] Visual Basic

Private Sub Form_Load()
  MsgBox "Hello, world"
End Sub

Alternatively, copy this into a New Form:

Private Sub Form_Click()
   Form1.Hide
   Dim HelloWorld As New Form1
   HelloWorld.Width = 2500: HelloWorld.Height = 1000: HelloWorld.Caption = "Hello, world!": HelloWorld.CurrentX = 500: HelloWorld.CurrentY = 75
   HelloWorld.Show: HelloWorld.Font = "Tahoma": HelloWorld.FontBold = True: HelloWorld.FontSize = 12: HelloWorld.Print "Hello, world!"
End Sub

[edit] Visual Basic .NET

Module HelloWorldApp
  Sub Main()
     System.Console.WriteLine("Hello, world!")
  End Sub
End Module

[edit] PICK/BASIC, DATA/BASIC, MV/BASIC

In addition to the ANSI syntax at the head of this article, most Pick operating system flavors of Dartmouth BASIC support extended syntax allowing cursor placement and other terminfo type functions for VDT’s

X, Y positioning (colon “:” is the concatenation instruction):

 PRINT @(34,12) : "Hello, world!" 

Will display the string “Hello, world!” roughly centered in a 80X24 CRT.

Other functions:

 PRINT @(-1) : @(34,12) : "Hello, world!"

Will clear the screen before displaying the string “Hello, world!” roughly centered in a 80X24 CRT.

Syntax variants:

 CRT "Hello, world!"

Supporting the “@” functions above, the CRT statement ignores previous PRINTER statements and always sends output to the screen.

Some Pick operating system environments such as OpenQM support the DISPLAY variant of PRINT. This variant in addition to the “@” functions maintains pagination based upon the settings of the TERM variable:

 DISPLAY "Hello, world!"

[edit] bc

"Hello, world!"

or, with the newline

print "Hello, world!\n"

[edit] BCPL

GET "LIBHDR"

LET START () BE
$(
    WRITES ("Hello, world!*N")
$)

[edit] BITGGAL AgileDog

T 
 1 "Hellow, World"
 0

[edit] BITGGAL Jihwaja

J( 1 TM 5 ZV 3 "Hellow, world" )

[edit] BLISS

%TITLE 'HELLO_WORLD'
MODULE HELLO_WORLD (IDENT='V1.0', MAIN=HELLO_WORLD,
        ADDRESSING_MODE (EXTERNAL=GENERAL)) =
BEGIN

    LIBRARY 'SYS$LIBRARY:STARLET';

    EXTERNAL ROUTINE
       LIB$PUT_OUTPUT;

GLOBAL ROUTINE HELLO_WORLD =
BEGIN
    LIB$PUT_OUTPUT(%ASCID %STRING('Hello, world!'))
END;

END
ELUDOM

[edit] boo

See also GUI Section.

print "Hello, world!"

[edit] Burning Sand 2

WRITE ELEMENT:Earth 210 230 40 CENTER TEXT "Hello World!"

[edit] Calprola

This program will work on the Avasmath 80 online programmable calculator.

#BTN A1
#PRI "HELLO WORLD!"
#END

[edit] Casio FX-9750

This program will work on the fx-9750 graphing calculator and compatibles.

"Hello, world!"

or

Locate 1,1,"Hello, world!"

[edit] C/AL – MBS Navision

OBJECT Codeunit 50000 HelloWorld
{
  PROPERTIES
  {
    OnRun=BEGIN
            MESSAGE(Txt001);
          END;
  }
  CODE
  {
    VAR
      Txt001@1000000000 : TextConst 'ENU=Hello, world!';
    BEGIN
    {
      Hello, world! in C/AL (Microsoft Business Solutions-Navision)
    }
    END.
  }
}

[edit] C

 #include <stdio.h>
 
 int main(void)
 {
    printf("Hello, world!\n");
    return 0;
 }

[edit] CCL

 call echo("Hello, world!")

[edit] Ch

The above C code can run in Ch as examples. The simple one in Ch is:

 printf("Hello, world!\n");

[edit] Chuck

 <<<"Hello World">>>;

[edit] C#

See also GUI Section.

class HelloWorldApp
{
    static void Main()
    {
        System.Console.WriteLine("Hello, world!");
    }
}

[edit] Chrome

namespace HelloWorld;
 
interface
 
type
  HelloClass = class
  public
    class method Main; 
  end;
 
implementation
 
class method HelloClass.Main;
begin
  System.Console.WriteLine('Hello, world!');
end;
 
end.

[edit] C++

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

or

#include <iostream>
 
int main()
{
    std::cout << "Hello, world!\n";
}

or

#include <iostream>
 
using namespace std;
 
int main(int argc, char *argv[])
{
    cout << "Hello, World!\n";
}

or

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

[edit] C++/CLI

int main()
{
   System::Console::WriteLine("Hello, world!");
}

[edit] C++, Managed (.NET)

#using <mscorlib.dll>
 
using namespace System;
 
int wmain()
{
    Console::WriteLine("Hello, world!");
}

[edit] ColdFusion (CFML)

<cfoutput>Hello, world!</cfoutput>

or simply

Hello, world!

[edit] COMAL

PRINT "Hello, world!"

[edit] CIL

.assembly Hello {}
.method public static void Main() cil managed
{
     .entrypoint
     .maxstack 1
     ldstr "Hello, world!"
     call void [mscorlib]System.Console::WriteLine(string)
     ret
}

[edit] CintieFramework (VisualBasic.NET)

<Script>
	<References>
		<Reference>System.dll</Reference>
	</References>
	<Code Language="VisualBasic">
<![CDATA[
Public Class Plugin
	Public Function MainF(ByVal Ob As Object) As String
		'Script Code
		Return "Hello, World!"
	End Function
End Class
]]>
	</Code>
</Script>

[edit] Clean

module hello

Start = "Hello, world!"

[edit] CLIST

PROC 0
WRITE Hello, world!

[edit] Clipper

? "Hello, world!"

or

@1,1 say "Hello, world!"

or

Qout("Hello, world")

[edit] CLU

start_up = proc ()
    po: stream := stream$primary_output ()
    stream$putl (po, "Hello, world!")
    end start_up

[edit] COBOL

IDENTIFICATION DIVISION.
PROGRAM ID.  HELLO-WORLD.
PROCEDURE DIVISION.
    DISPLAY "Hello, world!"
    STOP RUN.

The above is a very abbreviated and condensed version, which omits the author name and source and destination computer types.

[edit] Cube

Function | Main  
WriteLine | "Hello, world"
End | Main

The ‘|’ refers to the separation of the two text fields in the Cube standard IDE.

[edit] D

 import std.stdio ;
 
 void main () {
     writefln("Hello, world!");
 }

[edit] D++

function main()
{
    screenput "Hello, world!";
}

[edit] DC an arbitrary precision calculator

[Hello, world!]p

[edit] OR

1468369091346906859060166438166794P

[edit] DCL batch

$ write sys$output "Hello, world!"

[edit] DIV

PROGRAM hello;
BEGIN
    write(0, 0, 0, 0, "Hello, world!");
    LOOP
        FRAME;
    END
END

[edit] DOLL

this::operator()
{
 import system.cstdio;
 puts("Hello, world!");
}

[edit] Dream Maker

mob
    Login()
        ..()
        world << "Hello, world!"

[edit] Dylan

module: hello

format-out("Hello, world!\n");

[edit] EAScripting

There are a number of ways to write “Hello, world!” in EAScripting. The following are some ways

[edit] EAS 0.0.1.*

set disp to "Hello, world!"
set dispto to item unit 5 //5 = default screen
release disp into dispto.

This would be a pure system called by

import system ea.helloworld
wait

[edit] Ed and Ex (Ed extended)

a
Hello, world!!
.
p

[edit] Eiffel

class HELLO_WORLD

create make
feature
    make is
    do
        io.put_string("Hello, world!%N")
    end -- make
end -- class HELLO_WORLD

[edit] Erlang

See also GUI section
-module(hello).
-export([hello_world/0]).

hello_world() -> io:fwrite("Hello, world!\n").

[edit] Euphoria

puts(1, "Hello, world!")

[edit] F#

print_endline "Hello, world!"

or

printfn "Hello, world!"

[edit] Factor

"Hello, world!" print

or gui version

"Hello, world!" <label> "Hi" open-window

[edit] Ferite

uses "console";

Console.println("Hello, world!");

[edit] filePro

 @once:
   mesgbox "Hello, world!" ; exit

[edit] Fjölnir

"halló" < main
{
   main ->
   stef(;)
   stofn
       skrifastreng(;"Halló, veröld!"),
   stofnlok
}
*
"GRUNNUR"
;

[edit] FOCAL

type "Hello, world!",!

or

t "Hello, world!",!

[edit] Focus

-TYPE Hellomello, world!

[edit] Forte TOOL

begin TOOL HelloWorld;

includes Framework;
HAS PROPERTY IsLibrary = FALSE;

forward  Hello;

-- START CLASS DEFINITIONS

class Hello inherits from Framework.Object

has public  method Init;

has property
    shared=(allow=off, override=on);
    transactional=(allow=off, override=on);
    monitored=(allow=off, override=on);
    distributed=(allow=off, override=on);

end class;
-- END CLASS DEFINITIONS

-- START METHOD DEFINITIONS

------------------------------------------------------------
method Hello.Init
begin
super.Init();

task.Part.LogMgr.PutLine('Hello, world!');
end method;
-- END METHOD DEFINITIONS
HAS PROPERTY
    CompatibilityLevel = 0;
    ProjectType = APPLICATION;
    Restricted = FALSE;
    MultiThreaded = TRUE;
    Internal = FALSE;
    LibraryName = 'hellowor';
    StartingMethod = (class = Hello, method = Init);

end HelloWorld;

[edit] Forth

: HELLO  ( -- )  ." Hello, world!" CR ;
  HELLO

or instead of compiling a new routine, one can type directly in the Forth interpreter console

 CR ." Hello, world!" CR

[edit] FORTRAN

   program hello
     print*, 'Hello, world!'
   end

[edit] FreeBasic

 PRINT "Hello World"
 SLEEP
 END

[edit] Fril

 ?((pp "Hello, world!"))     

or

pp "Hello, world!"

[edit] Frink

println["Hello, world!"]

[edit] Gambas

See also GUI section.

PUBLIC SUB Main()
  Print "Hello, world!"
END

[edit] GEMBase 4GL

procedure_form hello
  begin_block world
      print "Hello, world!"
  end_block
end_form

[edit] GO (from google)

package main

import "fmt"

func main() {
  fmt.Printf("Hello, world!")
}

[edit] Groovy

println "Hello, world!"

[edit] GML (Game Maker Language)

In the draw event of some object:

draw_text(x,y,"Hello, world!")

Or to show a splash screen message:

show_message("Hello, world!")

[edit] GraalScript 1

 if (created) {
   echo Hello, world!;
 }

[edit] GraalScript 2

 function onCreated() {
   echo("Hello, world!");
 }

[edit] Haskell

main = putStrLn "Hello, world!"

[edit] haXe

class HelloWorldApp
{
    static function main()
    {
        trace("Hello, world!");
    }
}

[edit] Heron

program HelloWorld;
functions {
  _main() {
    print_string("Hello, world!");
  }
}
end

[edit] HP 33s

(Handheld Hewlett-Packard RPN-based scientific calculator.)

LBL H
SF 10
EQN
RCL H
RCL E
RCL L
RCL L
RCL O
R/S
RCL W
RCL O
RCL R
RCL L
RDL D
ENTER
R/S

[edit] HP-41 & HP-42S

(Handheld Hewlett-Packard RPN-based alphanumeric engineering calculators.)

01 LBLTHELLO

02 THello, world!

03 PROMPT

HP-41 output

[edit] HyperTalk (Apple HyperCard’s scripting programming language)

put "Hello, world!"

or

Answer "Hello, world!"

[edit] IDL

print,"Hello, world!"

[edit] Inform 5/6

[ Main;
  "Hello, world!";
];

[edit] Inform 7

Hello World is a room.  The printed name is "Hello, world!"

[edit] Io

"Hello, world!" println

or

writeln("Hello, world!")

[edit] Iptscrae

ON ENTER {
    "Hello, " "world!" & SAY
}

[edit] J

 'Hello, world!' NB. echoes the string in interactive mode, doesn't work in script
 'Hello World!' 1!:2(2) NB. prints it to (2) - screen, (4) - stdout

[edit] Jal

 include 16f877_20
 include hd447804
 
 hd44780_clear
 
 hd44780 = "H"
 hd44780 = "e"
 hd44780 = "l"
 hd44780 = "l"
 hd44780 = "o"
 hd44780 = " "
 hd44780 = "W"
 hd44780 = "o"
 hd44780 = "r"
 hd44780 = "l"
 hd44780 = "d"
 hd44780 = "!"

[edit] Java

See also GUI section.

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

[edit] Java byte-code

(disassembler output of javap -c HelloWorld)

public class HelloWorld extends java.lang.Object{
public HelloWorld();
 Code:
  0:   aload_0
  1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
  4:   return
public static void main(java.lang.String[]);
 Code:
  0:   getstatic       #2; //Field java/lang/System.out:Ljava/io/PrintStream;
  3:   ldc     #3; //String Hello, world!
  5:   invokevirtual   #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
  8:   return
}

[edit] JavaFX

JavaFX is scripting language formerly called F3 for Form Follows Function

Frame {
   title: "Hello World JavaFX"
   width: 200
   content: Label {
      text: "Hello World"
   }
   visible: true
}

This program can also be written in this way:

var win = new Frame();
win.title = "Hello World JavaFX";
win.width = 200;
var label = new Label();
label.text = "Hello World";
win.content = label;
win.visible = true;

A simple console output version would be:

import java.lang.System;
System.out.println("Hello World");

Or even simpler (with a built-in function):

println("Hello World");

[edit] JavaScript

JavaScript does not have native (built in) input or output routines. Instead it relies on the facilities provided by its host environment.

Using a standard Web browser’s document object

document.writeln('Hello, World!');

or with an alert, using a standard Web browser’s window object (window.alert)

alert('Hello, world!');

or, from the Mozilla command line implementation

print('Hello, world!');

or, from the Windows Script Host

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

[edit] JSP

<%@ page contentType="text/html;charset=WINDOWS-1252"%>
<HTML>
   <BODY>
        <% out.println(" Hello, world!"); %>
   </BODY>
</HTML>

or just

 <% out.println("Hello, world!"); %> 

or literally

 Hello, world!

[edit] Joy

"Hello, world!\n" putchars .

[edit] K

`0:"Hello, world!\n"

[edit] Kogut

WriteLine "Hello, world!"

[edit] KPL (Kids Programming Language)

Program HelloWorld
   Method Main()
      ShowConsole()
      ConsoleWriteLine("Hello, world!")
   End Method
End Program

[edit] Lasso

Output: 'Hello, world!';

or

Output('Hello, world!');

or simply

'Hello, world!';

[edit] Lexico Mobile (in spanish)

tarea muestre "Hola mundo !"

or

clase Saludo derivada_de Form
publicos
mensajes
Saludo copie "Hola mundo !" en saludo.Text

[edit] Limbo

implement Command;

include "sys.m"
    sys: Sys;

include "draw.m";

include "sh.m";

init(nil: ref Draw->Context, nil: list of string)
{
    sys = load Sys Sys->PATH;
    sys->print("Hello, world!!\n");
}

[edit] Linden Scripting Language

Linden Scripting Language is the scripting language used within Second Life

default
{
    state_entry()
    {
        llSetText("Hello, World!" , <0,0,0> , 1.0);
        //or...
        llSay(0,"Hello, World!");
    }
}

[edit] Linotte

Livre : HelloWorld
 Paragraphe : Affichage
 Actions :
   "Hello, World !" !

[edit] Lisaac

Section Header
  + name := HELLO_WORLD_PROGRAM;
 
Section Public
  - main <-
  (
    "Hello world!\n".print;
  );

[edit] Lisp

Lisp has many dialects that have appeared over its almost fifty-year history.

[edit] Common Lisp

(format t "Hello, world!~%")

or

(write-line "Hello, world!")

or in the REPL:

"Hello, world!"

(As a string (enclosed in quotes) it evaluates to itself, so is printed.)

[edit] Scheme

(display "Hello, world!\n")

[edit] Clojure

(println "Hello, world!")

[edit] Emacs Lisp

(print "Hello, world!")

or:

(message "Hello, world!")

[edit] AutoLisp

(print "Hello, world!")

[edit] XLISP

(print "Hello, world!")

[edit] Arc

(prn "Hello, world!")

[edit] Logo

print [Hello, world!]

or

pr [Hello, world!]

In mswlogo only

messagebox [Hi] [Hello, world!]

[edit] LPC

 void create()
 {
     write("Hello, world!\n");
 }

[edit] Lua

io.write("Hello, world!\n")

or

return "Hello, World!"

or

print("Hello, world")

[edit] LuaPSP

screen:print(1,1,"Hello, world!")
screen:flip()

[edit] Neko

$print("Hello, world!!\n");

[edit] M (MUMPS)

W "Hello, world!"

[edit] Caché Server Pages (CSP)

Class Test.Hello Extends %CSP.Page [ ProcedureBlock ]
{
   ClassMethod OnPage() As %Status
   {
       &html<<html>
       <head>
       </head>
       <body>>
       Write "Hello, world!",!
       &html<</body>
       </html>>
       Quit $$$OK
   }
}

[edit] M# Fictional Computer Language

[edit] Script

main(std:string >>arg<< / OS.GetArg)
{
     std:stream >>CONSOLE<< / OS.Console;

     CONSOLE:Write([byte]{0048, 0065, 006C, 006C, 006F, 002C, 0058, 006F, 0072, 006C, 0064});
     //                    H     e     l     l     o     ,     W     o     r     l     d   //
}

[edit] Command WI

# # DEFINE g >>CONSOLE<< / OS.Console
# % proc CONSOLE:Write([byte]{0048, 0065, 006C, 006C, 006F, 002C, 0058, 006F, 0072, 006C, 0064})

[edit] Command WoI

# @ Write([byte]{0048, 0065, 006C, 006C, 006F, 002C, 0058, 006F, 0072, 006C, 0064})

[edit] M4

Hello, world!

[edit] Macsyma, Maxima

print("Hello, world!")$

[edit] Maple

print("Hello, world!");

[edit] Mathematica

Print["Hello, world!"]

or simply:

"Hello, world!"

[edit] MATLAB

disp('Hello, world!')

or

fprintf('Hello, world!')

or with a GUI

figure('Position',[100 100 200 200],'MenuBar','none','Name','Hello World');
uicontrol('Style','text','Position',[15 100 150 15],'String','Hello world');

[edit] Maude

fmod HELLOWORLD is
protecting STRING .
  op helloworld : -> String .
  eq helloworld = "Hello, world!" .
endfm
red helloworld .

[edit] Max

max v2;
#N vpatcher 10 59 610 459;
#P message 33 93 63 196617 Hello, world!!;
#P newex 33 73 45 196617 loadbang;
#P newex 33 111 31 196617 print;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P pop;

[edit] Maya Embedded Language

print( "Hello, world!\n" );

[edit] mIRC Script

/echo Hello, world!

[edit] Model 204

BEGIN
PRINT 'Hello, world!'
END

[edit] Modula-2

MODULE Hello;

FROM InOut IMPORT WriteLn, WriteString;

BEGIN
   WriteString ("Hello, world!");
   WriteLn
END Hello.

[edit] MOO

This requires that you be the player or a wizard:

notify(player, "Hello, world!");

This is specific to the implementation of the core used for the moo, but works on most well known moos, such as LambdaCore or JH-Core:

player:tell("Hello, world!");

[edit] Mouse

"Hello, World!"
$

[edit] MS-DOS batch

(with the standard command.com interpreter. The @ symbol is optional and prevents the system from repeating the command before executing it. The @ symbol must be omitted on versions of MS-DOS prior to 3.0.). It’s very common for batchfiles to start with two lines of “@echo off” and “cls”.

 @echo Hello, world!

For MS-DOS 3.0 or lower

echo off
cls
echo Hello, world!

[edit] MUF

: main
  me @ "Hello, world!" notify
;

[edit] Natural

WRITE 'Hello, world!'
END

or

WRITE 'Hello, world!'.

[edit] Nemerle

The easiest way to get Nemerle print “Hello, world!” would be that:

System.Console.WriteLine("Hello, world!");

however, in bigger applications the following code would be probably more useful:

using System.Console;

module HelloWorld
{
   Main():void
   {
      WriteLine("Hello, world!");
   }
}

[edit] Oberon

Oberon is both the name of a programming language and an operating system.

Program written for the Oberon operating system:

MODULE Hello;
        IMPORT Oberon, Texts;
 VAR W: Texts.Writer;

 PROCEDURE World*;
 BEGIN
   Texts.WriteString(W, "Hello, world!");
   Texts.WriteLn(W);
   Texts.Append(Oberon.Log, W.buf)
 END World;

BEGIN
 Texts.OpenWriter(W)
END Hello.

Freestanding Oberon program using the standard Oakwood library:

MODULE Hello;
   IMPORT Out;
BEGIN
   Out.String("Hello, world!");
   Out.Ln
END Hello.

[edit] Objective C

[edit] Procedural C Version

#import <stdio.h>
 
int main (int argc, const char *argv[])
{
    printf ("Hello, world!\n");
    return 0;
}

[edit] Object-Oriented C Version

#import <stdio.h>
#import <objc/Object.h> 
 
@interface Hello : Object
{
}
- hello;
@end 
 
@implementation Hello
- hello
{
   printf("Hello, world!\n");
}
@end 
 
int main(void)
{
   id obj;
   obj = [Hello new];
   [obj hello];
   [obj free];
   return 0;
}

[edit] OPENSTEP/Cocoa Version

#import <Foundation/Foundation.h>
 
int main (int argc, const char * argv[])
{
   NSLog(@"Hello, world!");
   return 0;
}

[edit] OCaml

print_endline "Hello, world!" ;;

[edit] occam

#USE "course.lib"

PROC hello.world(CHAN OF BYTE screen!)
  out.string("Hello, world!*n", 0, screen!)
:

or without using course.lib

PROC hello.world(CHAN OF BYTE screen!)
  SEQ
    screen ! 'H'
    screen ! 'e'
    screen ! 'l'
    screen ! 'l'
    screen ! 'o'
    screen ! ','
    screen ! ' '
    screen ! 'w'
    screen ! 'o'
    screen ! 'r'
    screen ! 'l'
    screen ! 'd'
    screen ! '!'
    screen ! '*n'
:

[edit] OPL

See also GUI section.

PROC hello:
  PRINT "Hello, world!"
ENDP

[edit] OPS5

(object-class request
         ^action)

(startup
   (strategy MEA)
   (make request ^action hello)
)

(rule hello
   (request ^action hello)
   (write |Hello, world!| (crlf))
)

[edit] OPS83

module hello (main)
{  procedure main( )
   {
      write() |Hello, world!|, '\n';
   };
};

[edit] Oz programming language

{Browse 'Hello, world!'}

[edit] Parrot assembly language

print "Hello, world!\n"
end

[edit] Parrot intermediate representation

.sub hello :main
  print "Hello, world!!\n"
.end

[edit] PAWN

main() {
    print("Hello World");
}

[edit] Pascal

program hello;
 
begin
  Writeln('Hello, world!');
end.

[edit] Perl

 print "Hello, world!\n";

(This is the first example in Learning Perl; the semicolon is optional.)

or

 package Hello;
 sub new() { bless {} }
 sub Hello() { print "Hello, world! \n" }
 package main;
 my $hello = new Hello;
 $hello->Hello();

[edit] Perl 6

 "Hello, world!".say

or

 say "Hello, world!";

or

 print "Hello, world!\n";

[edit] PHP

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

or

<?php
  print "Hello, world!";
 ?>

or if short open tags are enabled

<?="Hello, world!"?>

[edit] Pike

int main() {
    write("Hello, world!\n");
    return 0;
}

[edit] PILOT

T:Hello, world!

[edit] PL/SQL

set serveroutput on size 1000000;  -- this is a SQL*Plus command to enable the output buffer
begin
    dbms_output.put_line('Hello, world!'); 
end;

[edit] PL/I

Test: proc options(main);
  put list('Hello, world!');
end Test;

[edit] POP-11

'Hello, world!' =>

[edit] Postscript

(Hello, world!\n) print

[edit] Processing

println("Hello, world!");

[edit] Progress 4GL

message "Hello, world!" view-as alert-box.

[edit] Prolog

:- write('Hello, world!'),nl.

[edit] Pure Data

#N canvas 0 0 300 300 10;
#X obj 100 100 loadbang;
#X msg 100 150 Hello, world!;
#X obj 100 200 print;
#X connect 0 0 1 0;
#X connect 1 0 2 0;

[edit] Python

‘Hello, World!'(With quotation marks) can be attained through::

'Hello, world!'

Prior to Python 3.0:

print "Hello, world!"

Python 3.0 or later:

print("Hello, world!")

[edit] Rebol

See also GUI section.

print "Hello, world!"

[edit] Redcode

; Should work with any MARS >= ICWS-86
; with 128x64 gfx core
Start MOV 0,2455
      MOV 0,2458
      MOV 0,2459
      MOV 0,2459
      MOV 0,2459
      MOV 0,2459
      MOV 0,2459
      MOV 0,2460
      MOV 0,2465
      MOV 0,2471
      MOV 0,2471
      MOV 0,2471
      MOV 0,2479
      MOV 0,2482
      MOV 0,2484
      MOV 0,2484
      MOV 0,2484
      MOV 0,2486
      MOV 0,2486
      MOV 0,2486
      MOV 0,2486
      MOV 0,2488
      MOV 0,2493
      MOV 0,2493
      MOV 0,2493
      MOV 0,2493
      MOV 0,2497
      MOV 0,2556
      MOV 0,2559
      MOV 0,2560
      MOV 0,2565
      MOV 0,2570
      MOV 0,2575
      MOV 0,2578
      MOV 0,2585
      MOV 0,2588
      MOV 0,2589
      MOV 0,2592
      MOV 0,2593
      MOV 0,2596
      MOV 0,2597
      MOV 0,2603
      MOV 0,2605
      MOV 0,2608
      MOV 0,2667
      MOV 0,2670
      MOV 0,2671
      MOV 0,2676
      MOV 0,2681
      MOV 0,2686
      MOV 0,2689
      MOV 0,2696
      MOV 0,2699
      MOV 0,2700
      MOV 0,2703
      MOV 0,2704
      MOV 0,2707
      MOV 0,2708
      MOV 0,2714
      MOV 0,2716
      MOV 0,2719
      MOV 0,2778
      MOV 0,2778
      MOV 0,2778
      MOV 0,2778
      MOV 0,2778
      MOV 0,2779
      MOV 0,2779
      MOV 0,2779
      MOV 0,2782
      MOV 0,2787
      MOV 0,2792
      MOV 0,2795
      MOV 0,2802
      MOV 0,2805
      MOV 0,2806
      MOV 0,2809
      MOV 0,2810
      MOV 0,2810
      MOV 0,2810
      MOV 0,2810
      MOV 0,2812
      MOV 0,2818
      MOV 0,2820
      MOV 0,2823
      MOV 0,2882
      MOV 0,2885
      MOV 0,2886
      MOV 0,2891
      MOV 0,2896
      MOV 0,2901
      MOV 0,2904
      MOV 0,2911
      MOV 0,2912
      MOV 0,2913
      MOV 0,2914
      MOV 0,2917
      MOV 0,2918
      MOV 0,2919
      MOV 0,2922
      MOV 0,2928
      MOV 0,2930
      MOV 0,2933
      MOV 0,2992
      MOV 0,2995
      MOV 0,2996
      MOV 0,3001
      MOV 0,3006
      MOV 0,3011
      MOV 0,3014
      MOV 0,3021
      MOV 0,3022
      MOV 0,3023
      MOV 0,3024
      MOV 0,3027
      MOV 0,3028
      MOV 0,3030
      MOV 0,3032
      MOV 0,3038
      MOV 0,3040
      MOV 0,3103
      MOV 0,3106
      MOV 0,3107
      MOV 0,3107
      MOV 0,3107
      MOV 0,3107
      MOV 0,3107
      MOV 0,3108
      MOV 0,3108
      MOV 0,3108
      MOV 0,3108
      MOV 0,3108
      MOV 0,3109
      MOV 0,3109
      MOV 0,3109
      MOV 0,3109
      MOV 0,3109
      MOV 0,3111
      MOV 0,3111
      MOV 0,3111
      MOV 0,3120
      MOV 0,3121
      MOV 0,3124
      MOV 0,3124
      MOV 0,3124
      MOV 0,3126
      MOV 0,3129
      MOV 0,3130
      MOV 0,3130
      MOV 0,3130
      MOV 0,3130
      MOV 0,3130
      MOV 0,3131
      MOV 0,3131
      MOV 0,3131
      MOV 0,3131
      MOV 0,3135
      JMP 0

Redcode HelloWorld running on a MARS

[edit] REFAL

$ENTRY GO{=<Prout 'Hello, world!'>;}

[edit] REXX, ARexx, NetRexx, and Object REXX

/* a starting comment is needed in mainframe versions */
say "Hello, world!"

[edit] RPG

[edit] Free-Form Syntax

/FREE

    DSPLY 'Hello, world!';

    *InLR = *On;

/END-FREE 

[edit] Traditional Syntax

With this syntax, a constant has to be used because the message must be placed in positions 12 to 25, between apostrophes.

     d TestMessage     c                   Const( 'Hello, world!' )

     c     TestMessage   DSPLY

     c                   EVAL      *InLR = *On

[edit] RPG Code

[edit] Message Window

Using the internal message window, a simple Hello, world! program can be rendered thus:

mwin("Hello, world!")
wait()

[edit] On Screen Text

An additional way to render text is by using the built in text() function.

text(1,1,"Hello, world!")
wait()

[edit] RPL

See also GUI section.

(On Hewlett-Packard HP-28, HP-48 and HP-49 series graphing calculators.)

<<
  CLLCD
  "Hello, world!" 1 DISP
  0 WAIT
  DROP
>>

[edit] RT Assembler

       _name   Hello~World!
       pause   Hello~World!
       exit
       _end

[edit] Ruby

See also GUI section.

 puts 'Hello, world!'

or

 'Hello, world!'.each { |s| print s }

or

 class String
     def say
         puts self
     end
 end
 'Hello, world!'.say

[edit] S (and R)

print("Hello, world")

or

message("Hello, world")

[edit] S-Lang

message("Hello, world!");

[edit] SAS

data _null_;
put 'Hello, world!';
run;

[edit] Sather

class HELLO_WORLD is
  main is 
   #OUT+"Hello, world!\n"; 
  end; 
end;

[edit] Scala

object HelloWorld extends Application {
  println("Hello, world!")
}

[edit] SCAR

program HelloWorld;
begin
 WriteLn('Hello world!');
end.

[edit] sed

(note: requires at least one line of input)

sed -ne '1s/.*/Hello, world!/p'

[edit] Seed7

$ include "seed7_05.s7i";

const proc: main is func
  begin
    writeln("Hello, world!");
  end func;

[edit] Self

'Hello, world!' print.

[edit] sense script

out('Hello, world!');

[edit] ShadowScript

'set up initial variables
struct.follow
 {
  cpu.fan.speed(500.rpm)
  cpu.max.process(100)
 }
<
 logic.handle(0)
 int main()
 int var()
 array.max(100000000)
>
'open and write the text in a free handle window
open mainwin(io<std>) as free(1)
 {
  write.free(1).("Hello",&sym," world",&sym)(&sym<",">&sym<"!">
  apply.free(1) to text
 }
'reset the fan, cpu, and vars
<
 logic(std)
 fan(std.auto)
 cpu.max(auto)
 unint main()
 unint var()
 un.array.max(std)
>
'end
end
.end/

[edit] Simula

BEGIN
    OutText("Hello, world!");
    OutImage;
END

[edit] Smalltalk

Transcript show: 'Hello, world!'

alternative:

StdoutStream nextPutLine: 'Hello, world'

[edit] SML

print "Hello, world!\n";

[edit] SNOBOL

    OUTPUT = "Hello, world!"
END

[edit] Span

class Hello {
  static public main: args {
    Console << "Hello, world!\n";
  }
}

[edit] SPARK

with Spark_IO;
--# inherit Spark_IO;
--# main_program;

procedure Hello_World
--# global in out Spark_IO.Outputs;
--# derives Spark_IO.Outputs from Spark_IO.Outputs;
is
begin
  Spark_IO.Put_Line (Spark_IO.Standard_Output, "Hello, world!", 0);
end Hello_World;

[edit] SPITBOL

    OUTPUT = "Hello, world!"
END

[edit] SSPL

1.0
print Hello, World!
end

[edit] SPSS Syntax

ECHO "Hello, world!".

[edit] SQL

CREATE TABLE message (text char(15));
INSERT INTO message (text) VALUES ('Hello, world!');
SELECT text FROM message;
DROP TABLE message;

or (for EnterpriseDB’s Stored Procedure Language (SPL))

BEGIN
    DBMS_OUTPUT.PUT_LINE('Hello, world!');
END;

or (e.g. Oracle dialect)

SELECT 'Hello, world!' FROM dual;

or (for Oracle’s PL/SQL proprietary procedural language)

BEGIN
  DBMS_OUTPUT.ENABLE(1000000);
  DBMS_OUTPUT.PUT_LINE('Hello, world!');
END;

or (e.g. MySQL or PostgreSQL dialect)

SELECT 'Hello, world!';

or (for PostgreSQL’s PL/pgSQL Procedural language)

CREATE FUNCTION hello_world() RETURNS text AS $$
  BEGIN
     RETURN 'Hello, world!';
  END
$$ LANGUAGE plpgsql;

or (e.g. T-SQL dialect)

PRINT 'Hello, world!'

or (for KB-SQL dialect)

select Null from DATA_DICTIONARY.SQL_QUERY
FOOTER or HEADER or DETAIL or FINAL event
write "Hello, world!"

[edit] STARLET

RACINE: HELLO_WORLD.

NOTIONS:
HELLO_WORLD : ecrire("Hello, world!").

[edit] STATA

Define program in script (.do-file) or at command line:

   capture program drop hello /*Define Hello, world! program*/
   program define hello   
        di "Hello, world!"
   end

   hello  /*run Hello, world! program*/

Or, interactively at the command line:

   di "Hello, world!"

[edit] SuperCollider

"Hello, world!".postln;

or, for interactive prompt,

"Hello, world!"

[edit] TACL

#OUTPUT Hello, world!

[edit] Tcl (Tool command language)

See also GUI section.

puts "Hello, world!"

[edit] Template Toolkit

[% GET "Hola mundo!"; %]

[edit] TOM (rewriting language)

public class HelloWorld {
 %include { string.tom }
 public final static void main(String[] args) {
   String who = "world";
   %match(String who) {
     "World" -> { System.out.println("Hello, " + who + "!"); }
     _       -> { System.out.println("Don't panic"); }
   }
 }

[edit] Turing

put "Hello, world!"

[edit] TSQL

Declare @Output varchar(16)
Set @Output='Hello, world!'
Select 'Output' = @Output

or, simpler variations:

Select 'Hello, world!'
Print 'Hello, world!'

[edit] TTCN-3

module hello_world {
  control {
    log("Hello, world!");
  }
}

[edit] UNIX-style shell

echo 'Hello, world!'

or using an inline ‘here document’

cat <<'DELIM'
Hello, world!
DELIM

or

printf '%s' $'Hello, world!\n'

or for a curses interface:

dialog --msgbox 'Hello, world!' 0 0

[edit] Verilog

module main();
       initial begin
              #0 $display("Hello, world!!");
              #1 $finish;
       end
endmodule

or (a little more complicated)

module hello(clk);
       input clk;
       always @(posedge clk) $display("Hello, world!!");
endmodule
module main();
       reg     clk;
       hello H1(clk);
       initial begin
              #0 clk=0;
              #5 clk=1;
              #1 $finish;
       end
endmodule
module hello(clk);
       input clk;
       always @(posedge clk) $display("Hello, world!!");
endmodule
module main();
       reg     clk;
       hello H1(clk);
       initial begin
              #0 clk=0;
              #23 $display("--23--");
              #100 $finish;
       end
       always #5 clk=~clk;
endmodule

[edit] VHDL

use std.textio.all;

entity Hello is
end Hello;

architecture Hello_Arch of Hello is
begin
       p : process
       variable l:line;
       begin
               write(l, String'("Hello, world!"));
               writeline(output, l);
               wait;
       end process;
end Hello_Arch;

[edit] Visual Basic Script

WScript.Echo "Hello, world!"

See also additional examples.

[edit] Visual Prolog

#include @"pfc\console\console.ph"

goal
  console::init(),
  stdio::write("Hello, world!").

[edit] Windows PowerShell

    "Hello, world!"

or:

   Write-Host "Hello, world!"

or:

   echo "Hello, world!"

or:

   [System.Console]::WriteLine("Hello, world!")

[edit] XL

   use XL.UI.CONSOLE
   WriteLn "Hello, world!"

or:

   import IO = XL.UI.CONSOLE
   IO.WriteLn "Hello, world!"

[edit] XMLmosaic

<Class>
  <Type>XMLmosaic Class</Type>
  <Method>
    <Name id="1">Main</Name>
    <Code id="1">void Main()
{
Console.WriteLine('Hello World!');
}
    </Code>
  </Method>
  <Counter>
    <Count>1</Count>
  </Counter>
</Class>

[edit] Yorick

write, "Hello, world!";

Note: The semicolon is optional.

[edit] Graphical user interfaces (GUIs)

[edit] ActionScript (Macromedia flash mx)

this.createTextField("hello_txt",0,10,10,100,20);
this.hello_txt.text="Hello, world!";

[edit] AppleScript

See also TUI section.

display dialog "Hello, world!" buttons {"OK"} default button 1

[edit] boo

See also TUI section.

import System.Drawing
import System.Windows.Forms
f = Form()
f.Controls.Add(Label(Text: "Hello, world!", Location: Point(40,30)))
f.Controls.Add(Button(Text: "Ok", Location: Point(50, 55), Click: {Application.Exit()}))
Application.Run(f)

Functional equivalent of C# program below.

[edit] C#

See also TUI section.

Simply, using Message Box:

 public class HelloWorld
 {
     static void Main()
     {
         System.Windows.Forms.MessageBox.Show("Hello, world!");
     }
 }

Or:

using System;
using System.Drawing;
using System.Windows.Forms;
 
 public class HelloWorldForm : Form 
 {
     public static void Main() 
     {
         Application.Run(new HelloWorldForm());
     }
 
     public HelloWorldForm() 
     {
        Label label = new Label();
        label.Text = "Hello, world!";
        label.Location = new Point(40,30);
        this.Controls.Add(label);
        Button button = new Button();
        button.Text = "OK";
        button.Location = new Point(50,55);
        this.Controls.Add(button);
        button.Click += new EventHandler(button_Click);
     }
 
     private void button_Click(Object sender, EventArgs e) 
     {
        Application.Exit();
     }
 }

[edit] Clarion

The simplest way to achieve this is with the built in message function that is similar to the windows messageBox().

   PROGRAM
   MAP
   END
   CODE
   MESSAGE('Hello, world!!','Clarion')
   RETURN

A more real world example uses a Clarion structure to declare a window and the Clarion Accept loop to process events from that window.

  PROGRAM
    MAP
HelloProcedure  PROCEDURE()
    END

    CODE
    HelloProcedure()
    RETURN

HelloProcedure  PROCEDURE()
Window WINDOW('Clarion for Windows'),AT(,,222,116),FONT('Tahoma',8,,FONT:regular),ICON('Hey.ICO'), |
         SYSTEM,GRAY
       STRING('Hello, world!!'),AT(91,22),USE(?String1)
       BUTTON('Close'),AT(92,78,37,14),USE(?CloseBtn),LEFT
     END
    CODE
    OPEN(Window)
    ACCEPT
      CASE ACCEPTED()
      OF ?CloseBtn
        POST(EVENT:CloseWindow)
      END
    END
    CLOSE(Window)
    RETURN

[edit] Cocoa or GNUStep (In Objective C)

#import <Cocoa/Cocoa.h>
@interface hello : NSObject {
}
@end
 
@implementation hello
 
-(void)awakeFromNib
{ 
     NSBeep(); // we don't need this but it's conventional to beep 
               // when you show an alert
     NSRunAlertPanel(@"Message from your Computer", @"Hello, world!", @"Hi!",
                     nil, nil);
}
 
@end

[edit] Curl

{curl 3.0, 4.0 applet}
{curl-file-attributes character-encoding = "utf-8"}

Hello, world!

[edit] Delphi, Kylix

program Hello_World;
uses    
  QDialogs;
 
begin
 
  ShowMessage('Hello, world!');
 
or
 
  MessageDlg ('Hello, world!', mtInformation, [mbOk], 0);
 
 
end.

[edit] Erlang

See also TUI section
-module(hello_world).
-export([hello/0]).

hello() ->
   S = gs:start(),
   Win = gs:create(window, S, [{width, 100}, {height, 50}]),
   gs:create(label, Win, [{label, {text, "Hello, world!"}}]),
   gs:config(Win, {map, true}),
   receive
      {gs, Win, destroy, _, _} ->
         gs:stop()
   end,
   ok.

One way of invoking this would be to enter hello_world:hello(). in the Erlang shell; another would be to run from a command line:

erl -noshell -run hello_world hello -run init stop

[edit] Euphoria

MS-Windows only – basic.

include msgbox.e
if message_box("Hello, world!", "Hello", 0) then end if

MS-Windows only – using Win32Lib library

include win32lib.ew
createForm({
       ";Window; Hello",
       ";Label;  Hello, world!"
   })
include w32start.ew

[edit] F#

Using WindowsForms, at the F# interactive prompt:

let _ = System.Windows.Forms.MessageBox.Show("Hello, world!");;

[edit] FLTK2 (in C++)

#include <fltk/Window.h>
#include <fltk/Widget.h>
#include <fltk/run.h>
using namespace fltk;
 
int main(int argc, char **argv)
{
    Window *window = new Window(300, 180);
    window->begin();
        Widget *box = new Widget(20, 40, 260, 100, "Hello, world!");
        box->box(UP_BOX);
        box->labelfont(HELVETICA_BOLD_ITALIC);
        box->labelsize(36);
        box->labeltype(SHADOW_LABEL);
     window->end();
     window->show(argc, argv);
 
    return run();
 }

[edit] G (LabVIEW)

See Labview.

TUI section.

PUBLIC SUB Main()
  Message.Info("Hello, world!")
END

[edit] Gtk# (in C#)

using Gtk;
using GtkSharp;
using System;
 
class Hello {
 
    static void Main()
    {
        Application.Init ();
 
        Window window = new Window("");
        window.DeleteEvent += cls_evn;
        Button close  = new Button ("Hello, world!");
        close.Clicked += new EventHandler(cls_evn);
 
        window.Add(close);
        window.ShowAll();
 
        Application.Run ();
 
    }
 
    static void cls_evn(object obj, EventArgs args)
    {
        Application.Quit();
    }
 
}

[edit] GTK+ 2.x (in Euphoria)

include gtk2/wrapper.e

Info(NULL,"Hello","Hello, world!")

[edit] IOC/OCL (in IBM VisualAge for C++)

#include <iframe.hpp>
void main()
{
    IFrameWindow frame("Hello, world!");
    frame.showModally()
}

[edit] Java

See also TUI section.

import javax.swing.JOptionPane;
 
public class Hello 
{
    public static void main(String[] args) 
    {
        JOptionPane.showMessageDialog(null, "Hello, world!");
    }
}

[edit] K

This creates a window labeled “Hello, world!” with a button labeled “Hello, world!”.

hello:hello..l:"Hello, world!"
hello..c:`button
`show$`hello

[edit] LabVIEW (G)

See LabVIEW.

Hi

[edit] Microsoft Foundation Classes (in C++)

#include <afx.h>
#include <afxwin.h>
 
class CHelloWin : public CWnd
{
protected:
 DECLARE_MESSAGE_MAP()
 afx_msg void OnPaint(void)
 {
 CPaintDC dc(this);
 dc.TextOut(15, 3, TEXT("Hello, world!"), 13);
 }
};
 
BEGIN_MESSAGE_MAP(CHelloWin, CWnd)
 ON_WM_PAINT()
END_MESSAGE_MAP()
 
class CHelloApp : public CWinApp
{
 virtual BOOL InitInstance();
};
 
CHelloApp theApp;
LPCTSTR wndClass;
 
BOOL CHelloApp::InitInstance()
{
 CWinApp::InitInstance();
 CHelloWin* hello = new CHelloWin();
 m_pMainWnd = hello;
 wndClass = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW, 0, (HBRUSH)::GetStockObject(WHITE_BRUSH), 0);
 hello->CreateEx(0, wndClass, TEXT("Hello MFC"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 120, 50, NULL, NULL);
 hello->ShowWindow(SW_SHOW);
 hello->UpdateWindow();
 return TRUE;
}

[edit] Adobe Flex MXML

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Label text="Hello, world!"/>
</mx:Application>

[edit] NSIS

This creates a message box saying “Hello, world!”.

OutFile "HelloWorld.exe"
Name "Hello, world!"
Caption "Hello, world!"
 
Section Hello, world!
SectionEnd
 
Function .onInit
    MessageBox MB_OK "Hello, world!" 
    Quit
FunctionEnd

[edit] OCaml

Uses lablgtk

let () = 
  let window = GWindow.window ~title:"Hello" ~border_width:10 () in
    window#connect#destroy ~callback:GMain.Main.quit;
    let button = GButton.button ~label:"Hello World" ~packing:window#add () in
      button#connect#clicked ~callback:window#destroy;
      window#show ();
      GMain.Main.main ()

[edit] OPL

See also TUI section.

(On Psion Series 3 and later compatible PDAs.)

PROC guihello:
  ALERT("Hello, world!","","Exit")
ENDP

or

PROC hello:
   dINIT "Window Title"
   dTEXT "","Hello, world!"
   dBUTTONS "OK",13
   DIALOG
ENDP

[edit] Pure Data

Patch as ASCII-art:

[Hello, world!(
|
[print]

Patch as sourcecode:

#N canvas 0 0 300 300 10;
#X msg 100 150 Hello, world!;
#X obj 100 200 print;
#X connect 0 0 1 0;

[edit] Python

Using Tkinter:

from Tkinter import *
 
root = Tk()
Label(root, text="Hello, world!").pack()
 
root.mainloop()

Using PyQt:

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
 
app = QApplication(sys.argv)
label = QLabel("Hello, World!")
label.show()
sys.exit(app.exec_())

Using PyGTK:

from gtk import *
 
label = Label("Hello, world!")
label.show()
 
window = Window()
window.add(label)
window.show()
 
main()

Using Curves:

from math import *
 
def f(x):
    return int(round(96.75 + -21.98*cos(x*1.118) + 13.29*sin(x*1.118) + -8.387*cos(2*x*1.118)\
               + 17.94*sin(2*x*1.118) + 1.265*cos(3*x*1.118) + 16.58*sin(3*x*1.118)\
               + 3.988*cos(4*x*1.118) + 8.463*sin(4*x*1.118) + 0.3583*cos(5*x*1.118)\
               + 5.878*sin(5*x*1.118)))
 
print "".join([chr(f(x)) for x in range(12)])

[edit] Qt toolkit (in C++)

 #include <qapplication.h>
 #include <qpushbutton.h>
 #include <qwidget.h>
 #include <iostream>
 
 class HelloWorld : public QWidget
 {
     Q_OBJECT
 
 public:
     HelloWorld();
     virtual ~HelloWorld();
 public slots:
     void handleButtonClicked();
     QPushButton *mPushButton;
 };
 
 HelloWorld::HelloWorld() :
     QWidget(),
     mPushButton(new QPushButton("Hello, world!", this))
 {
   connect(mPushButton, SIGNAL(clicked()), this, SLOT(handleButtonClicked()));
 }
 
 HelloWorld::~HelloWorld() {}
 
 void HelloWorld::handleButtonClicked()
 {
     std::cout << "Hello, world!" << std::endl;
 }
 
 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
     HelloWorld helloWorld;
     app.setMainWidget(&helloWorld);
     helloWorld.show();
     return app.exec();
 }

or

 #include <QApplication>
 #include <QPushButton>
 #include <QVBoxLayout>
 
 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
 
     QWidget *window = new QWidget;
     QVBoxLayout *layout = new QVBoxLayout(window);
     QPushButton *hello = new QPushButton("Hello, world!", window);
 
     //connect the button to quitting
     hello->connect(hello, SIGNAL(clicked()), &app, SLOT(quit()));
 
     layout->addWidget(hello);
     layout->setMargin(10);
     layout->setSpacing(10);
 
     window->show();
 
     return app.exec();
 }

[edit] Rebol

See also TUI section.

view layout [text "Hello, world!"]

[edit] Robotic (MegaZeux)

* "Hello, world!"
end

[edit] RPL

See also TUI section.

(On Hewlett-Packard HP-48G and HP-49G series calculators.)

<< "Hello, world!" MSGBOX >>

[edit] RTML

Hello ()
TEXT "Hello, world!"

[edit] Ruby with WxWidgets

See also TUI section.

require 'wxruby'
 
class HelloWorldApp < Wx::App
 def on_init
  ourFrame = Wx::Frame.new(nil, -1, "Hello, world!").show
  ourDialogBox = Wx::MessageDialog.new(ourFrame, "Hello, world!", "Information:", \
                 Wx::OK|Wx::ICON_INFORMATION).show_modal
 end
end
 
HelloWorldApp.new.main_loop

[edit] Ruby with GTK+

See also TUI section.

require 'gtk2'
 
Gtk.init
window = Gtk::Window.new
window.signal_connect("delete_event") { Gtk.main_quit; false }
button = Gtk::Button.new("Hello, world!")
button.signal_connect("clicked") { Gtk.main_quit; false }
window.add(button)
window.show_all
Gtk.main

[edit] Ruby with Tk

See also TUI section

require 'tk'
 
window = TkRoot.new { title 'Hello, world!' }
button = TkButton.new(window) {
 text 'Hello, world!'
 command proc { exit }
 pack
}
 
Tk.mainloop

[edit] Smalltalk

See also TUI section.

Evaluate in a workspace:

Dialog confirm: 'Hello, world!'

Using the Morphic GUI toolkit of Squeak Smalltalk:

('Hello, world!' asMorph openInWindow) submorphs second color: Color black

Using wxSqueak:

Wx messageBox: 'Hello, world!'

[edit] SWT (in Java)

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
 public class SWTHello {
     public static void main (String [] args) {
         Display display = new Display ();
         final Shell shell = new Shell(display);
         RowLayout layout = new RowLayout();
         layout.justify = true;
         layout.pack = true;
         shell.setLayout(layout);
         shell.setText("Hello, world!");
         Label label = new Label(shell, SWT.CENTER);
         label.setText("Hello, world!");
         shell.pack();
         shell.open ();
         while (!shell.isDisposed ()) {
             if (!display.readAndDispatch ()) display.sleep ();
         }
         display.dispose ();
     }
 }

[edit] Tk

See also TUI section.

label .l -text "Hello, world!"
pack .l

and the same in one line

pack [label .l -text "Hello, world!"]

[edit] Tcl with Tk

package require Tk
tk_messageBox -message "Hello, world!"

or

package require Tk
pack [button .b -text "Hello, world!" -command exit]

[edit] Ubercode

 Ubercode 1 class Hello
 public function main()
 code
   call Msgbox("Hello", "Hello, world!")
 end function
 end class

[edit] Uniface

 message "Hello, world!"

[edit] Virtools

[edit] VBA

Sub Main()
    MsgBox "Hello, world!"
End Sub

[edit] Visual Basic .NET 2003/2005

Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  MessageBox.Show("Hello, world!")
  Me.Close()    
End Sub

Note that the previous example will only work when the code is entered as part of a Form Load Event, such as the one created by default when generating a new project in the Visual Studio programming environment. Equivalently, the following code is roughly equivalent to the traditional Visual Basic 6 code by disabling the Application Framework and setting ‘Sub Main’ as the entry point for the application:

Public Module MyApplication
  Sub Main()
     MessageBox.Show("Hello, world!")
  End Sub
End Class

or using a class;

Public Class MyApplication
  Shared Sub Main()
     MessageBox.Show("Hello, world!")
  End Sub
End Class

[edit] Visual Prolog (note box)

#include @"pfc\vpi\vpi.ph"

goal
  vpiCommonDialogs::note("Hello, world!").

[edit] Windows API (in C)

This uses the Windows API to create a full window containing the text. Another example below uses the built-in MessageBox function instead.

/*
 Name: Win32 example
 Copyright: GLP
 Author: Ryon S. Hunter( BlackNine313@gmail.com )
 Date: 20/03/07 17:11
 Description: This is an example of what a Win32 hello world looks like.
*/
#include <windows.h>
#define APPTITLE "Win32 - Hello world"
BOOL InitInstance(HINSTANCE,int);
ATOM MyRegisterClass(HINSTANCE);
LRESULT CALLBACK WinProc(HWND,UINT,WPARAM,LPARAM);
LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
       PAINTSTRUCT ps;
       COLORREF c = RGB( 0, 0, 0 );
       HDC hdc;
       RECT rt;
       switch(message)
       {
                      case WM_DESTROY: // Exit the window? Ok
                            PostQuitMessage(0);
                      break;
                       case WM_PAINT:
                           GetClientRect( hWnd, &rt );
                           hdc = BeginPaint( hWnd, &ps );
                           DrawText( hdc, "Hello world!", sizeof( "Hello world!" ), &rt, DT_CENTER );
                           EndPaint( hWnd, &ps );
                      break;
       }
       return DefWindowProc(hWnd,message,wParam,lParam);
}
ATOM MyRegisterClass(HINSTANCE hInstance)
{
    WNDCLASSEX wc;
    wc.cbSize = sizeof( WNDCLASSEX );
    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = (WNDPROC)WinProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = 0;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor( NULL, IDC_ARROW );
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = APPTITLE;
    wc.hIconSm = NULL;
 
    return RegisterClassEx(&wc);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    HWND hWnd;
    hWnd = CreateWindow( // Create a win32 window
         APPTITLE,
         APPTITLE,
         WS_OVERLAPPEDWINDOW,
         CW_USEDEFAULT,
         CW_USEDEFAULT,
         500,
         400,
         NULL,
         NULL,
         hInstance,
         NULL);
    if(!hWnd){ return FALSE; }
    ShowWindow( hWnd, nCmdShow );
    UpdateWindow( hWnd );
    return TRUE;
}
int WINAPI WinMain( HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine,
                    int nCmdShow )
{
                    MSG msg;
                    MyRegisterClass(hInstance);
                    if(!InitInstance( hInstance,nCmdShow) )
                                      return 1;
                    while( GetMessage( &msg, NULL, 0, 0 ) )
                    {
                           TranslateMessage( &msg );
                           DispatchMessage( &msg );
                    }
                    return msg.wParam;
}

[edit] XUL

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="Hello, World!"/>
</window>

[edit] Maple

with(Maplets):
with(Maplets[Elements]):
maplet := Maplet( "Hello world!" ):
Display( maplet );

[edit] Document formats

[edit] ASCII

The following sequence of characters, expressed in hexadecimal notation (with carriage return and newline characters at end of sequence):

48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 21 0D 0A

The following sequence of characters, expressed as binary numbers (with cr/nl as above, and the same ordering of bytes):

00-07: 01001000 01100101 01101100 01101100 01101111 00101100 00100000 01110111
08-0E: 01101111 01110010 01101100 01100100 00100001 00001101 00001010

[edit] Page description languages

[edit] XHTML 1.1

(Using UTF-8 character set.)

 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
   <title>Hello, world!</title>
  </head>
  <body>
   <p>Hello, world!</p>
  </body>
 </html>

[edit] HTML

[edit] Simple

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

[edit] Informal

The <html> and <body> tags are not necessary for informal testing. Simply write it as text without tags.

Hello, world!

[edit] HTML 4.01 Strict (full)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Hello, world!</title>
  </head>
  <body>
    <p>Hello, world!</p>
  </body>
</html>

The first paragraph of the W3C Recommendation on The global structure of an HTML document also features this example.

[edit] HTML 4.01 Strict (smallest)

This is the smallest legal version, leaving out all optional tags

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
<title>Hello, world!</title>
<p>Hello, world!</p>

[edit] PDF

%PDF-1.0
1 0 obj
<<
/Type /Catalog
/Pages 3 0 R
/Outlines 2 0 R
>>
endobj
2 0 obj
<<
/Type /Outlines
/Count 0
>>
endobj
3 0 obj
<<
/Type /Pages
/Count 1
/Kids [4 0 R]
>>
endobj
4 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources << /Font << /F1 7 0 R >>/ProcSet 6 0 R
>>
/MediaBox [0 0 612 792]
/Contents 5 0 R
>>
endobj
5 0 obj
<< /Length 44 >>
stream
BT
/F1 24 Tf
100 100 Td (Hello, world!) Tj
ET
endstream
endobj
6 0 obj
[/PDF /Text]
endobj
7 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /MacRomanEncoding
>>
endobj
xref
0 8
0000000000 65535 f
0000000009 00000 n
0000000074 00000 n
0000000120 00000 n
0000000179 00000 n
0000000322 00000 n
0000000415 00000 n
0000000445 00000 n
trailer
<<
/Size 8
/Root 1 0 R
>>
startxref
553
%%EOF

This is a valid PDF only if the text file has CRLF line endings.

[edit] PostScript

% Displays on console.
(Hello, world!) =
%!
% Displays as page output.
/Courier findfont
24 scalefont
setfont
100 100 moveto
(Hello, world!) show
showpage

[edit] RTF

{\rtf1\ansi\deff0
{\fonttbl {\f0 Courier New;}}
\f0\fs20 Hello, world!
}

[edit] SVG

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <svg xmlns="http://www.w3.org/2000/svg" width="200" height="100">
  <text x="50" y="50">Hello, world!</text>
 </svg>

[edit] TeX

Hello, world!
\bye

[edit] LaTeX 2ε

 \documentclass{article}
 \begin{document}
   Hello, world!
 \end{document}

[edit] ConTeXt

 \starttext
   Hello, world!
 \stoptext

[edit] Media-based scripting languages

[edit] AviSynth

BlankClip()
Subtitle("Hello, world!")

(Creates a video with default properties)

[edit] Lingo (Macromedia Director scripting language)

on exitFrame me
  put "Hello, world!"  
end

Outputs the string to the message window if placed in a single movie frame. Alternatively, to display an alert box stating the message you could use

on exitFrame me
  alert "Hello, world!"
end

[edit] POV-Ray

#include "colors.inc"
camera {
  location <3, 1, -10>
  look_at <3,0,0>
}
light_source { <500,500,-1000> White }
text {
  ttf "timrom.ttf" "Hello, world!" 1, 0
  pigment { White }
}

[edit] Esoteric programming languages

This page shows the Hello, world! program in esoteric programming languages — that is, working programming languages that were designed as experiments or jokes and were not intended for serious use.

[edit] Befunge

"!dlrow olleH">v
               :
               ,
              ^_@
v v"Hello, world!!"<
>                  ^
> >:#v_@
^   .<
0"!dlrow olleH">,:#<_@

[edit] BlooP, FlooP

From Eric Raymond’s interpreter package (changed to use upper case as in the book).

   DEFINE PROCEDURE ''HELLO-WORLD''[N]:
   BLOCK 0: BEGIN
       PRINT['Hello, world!'];
   BLOCK 0: END.

[edit] Brainfuck

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

[edit] Chef

   Hello, world! Souffle.
  
   Ingredients.
   72 g haricot beans
   101 eggs
   108 g lard
   111 cups oil
   32 zucchinis
   119 ml water
   114 g red salmon
   100 g dijon mustard
   33 potatoes
   
   Method.
   Put potatoes into the mixing bowl.
   Put dijon mustard into the mixing bowl.
   Put lard into the mixing bowl. 
   Put red salmon into the mixing bowl.
   Put oil into the mixing bowl.
   Put water into the mixing bowl.
   Put zucchinis into the mixing bowl.
   Put oil into the mixing bowl.
   Put lard into the mixing bowl.
   Put lard into the mixing bowl.
   Put eggs into the mixing bowl.
   Put haricot beans into the mixing bowl.
   Liquefy contents of the mixing bowl.
   Pour contents of the mixing bowl into the baking dish.
   
   Serves 1.

[edit] False

"Hello, World!
"

The newline before the terminating quote mark is necessary.

[edit] HQ9+

   H

[edit] INTERCAL programming language

   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

[edit] LOLCODE

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

[edit] KEMURI

http://www.nishiohirokazu.org/blog/2006/09/kemuri_1.html

The text “Hello, world!” is built into the interpreter. The following code calls out the text to the output stream.

`|

[edit] Malbolge programming language

(=<`:9876Z4321UT.-Q+*)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk**hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@98\6543W10/.R,+O<

[edit] P programming language

"Hello, world!\n"

[edit] Perl

Not really an esoteric language, but this code uses obfuscation:

qq chop lc and print chr ord uc q chop uc and print chr ord q ne sin and 
print chr ord qw q le q and print chr ord q else and print chr ord q pop 
and print chr oct oct ord uc qw q bind q and print chr ord q q eq and print 
chr ord qw q warn q and print chr ord q pop and print chr ord q qr q and 
print chr ord q else and print chr ord qw q do q and print chr hex length 
q q semctl setpgrp chop q

[edit] PingPong Programming Language

PingPong Programming Language

1-dlroW$ olleH#/<\@
               \./

[edit] Piet

Example Hello world image

http://en.wikipedia.org/wiki/Piet

[edit] Shakespeare

The Infamous Hello, world! Program.

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.


                   Act I: Hamlet's insults and flattery.

                   Scene I: The insulting of Romeo.

[Enter Hamlet and Romeo]

Hamlet:
 You lying stupid fatherless big smelly half-witted coward!
 You are as stupid as the difference between a handsome rich brave
 hero and thyself! Speak your mind!

 You are as brave as the sum of your fat little stuffed misused dusty
 old rotten codpiece and a beautiful fair warm peaceful sunny summer's
 day. You are as healthy as the difference between the sum of the
 sweetest reddest rose and my father and yourself! Speak your mind! 

 You are as cowardly as the sum of yourself and the difference
 between a big mighty proud kingdom and a horse. Speak your mind.

 Speak your mind!

[Exit Romeo]

                   Scene II: The praising of Juliet.

[Enter Juliet]

Hamlet:
 Thou art as sweet as the sum of the sum of Romeo and his horse and his
 black cat! Speak thy mind!

[Exit Juliet]

                   Scene III: The praising of Ophelia.

[Enter Ophelia]

Hamlet:
 Thou art as lovely as the product of a large rural town and my amazing
 bottomless embroidered purse. Speak thy mind!

 Thou art as loving as the product of the bluest clearest sweetest sky
 and the sum of a squirrel and a white horse. Thou art as beautiful as
 the difference between Juliet and thyself. Speak thy mind!

[Exeunt Ophelia and Hamlet]


                   Act II: Behind Hamlet's back.

                   Scene I: Romeo and Juliet's conversation.

[Enter Romeo and Juliet]

Romeo:
 Speak your mind. You are as worried as the sum of yourself and the
 difference between my small smooth hamster and my nose. Speak your
 mind!

Juliet:
 Speak YOUR mind! You are as bad as Hamlet! You are as small as the
 difference between the square of the difference between my little pony
 and your big hairy hound and the cube of your sorry little
 codpiece. Speak your mind!

[Exit Romeo]

                   Scene II: Juliet and Ophelia's conversation.

[Enter Ophelia]

Juliet:
 Thou art as good as the quotient between Romeo and the sum of a small
 furry animal and a leech. Speak your mind!

Ophelia:
 Thou art as disgusting as the quotient between Romeo and twice the
 difference between a mistletoe and an oozing infected blister! Speak
 your mind!

[Exeunt]

[edit] SNUSP

   /e+++++++++++++++++++++++++++++.\  
   ./\/\/\  /+++\!>.+++o.l.+++++++l/                  #/?\  
$H!\++++++\ +   \comma.------------ .<w++++++++.\ /?\<!\-/
   /++++++/ +/\                      /.--------o/ \-/!.++++++++++/?\n
 /=\++++++\ +\\!=++++++\             \r+++.l------.d--------.>+.!\-/
 \!\/\/\/\/ \++++++++++/

Modular SNUSP:

      /@@@@++++#               #+++@@\                #-----@@@\n
$@\H.@/e.+++++++l.l.+++o.>>++++.< .<@/w.@\o.+++r.++@\l.@\d.>+.@/.#
  \@@@@=>++++>+++++<<@+++++#       #---@@/!=========/!==/

[edit] Spoon (programming language)

0101111111110010001111111111010000001101100101001011111110010001111110
1000000110111001010111111100101000101011100101001011111111111001000110
0000000000000000001000000110110000010100000000000000000000000000000000
0000000101001011111111111001000111111101000000110110010100101111110010
0011111101000000110110010101110010100000000000000000000010100000000000
0000000000000000101001011111111111001000110000000000000000000100000011
011000001010

[edit] Super NAND Time!!

12 (32 35 37 38 42)
13 (35 37 38 39 43)
14 ((31 36 39 42 43))
15 (31 33 34 35 38 40 43)
16 (37 39)
17 ((31 43))
18 ((36 42 43))
20 ((42(43)))
21 44
31 ((31)(44))
32 (32(31))
33 (33(32))
34 (34(33))
35 (35(34))
36 (36(35))
37 (37(36))
38 (38(37))
39 (39(38))
40 (40(39))
41 (41(40))
42 (42(41))
43 (43(42))
44 1

[edit] T programming language

%begin @jump $main
%main.0 @echo %msg
%main.1 @end
%main.count 2
%msg Hello, world!

[edit] This=That

x=Hello,world!
x=print

[edit] Unlambda programming language

  `r```````````.H.e.l.l.o. .w.o.r.l.di

[edit] Var’aq programming language

Note: actually prints “What do you want, universe?” in Klingon.

    ~ nuqneH { ~ 'u' ~ nuqneH disp disp } name
   nuqneH

[edit] Whitespace

Note that whitespace has been highlighted (Space, Tab)

   
   	  	   
		    	
   		  	 	
		    	 
   		 		  
		    		
   		 		  
		    
	  
   		 				
		    	 	
   	 		  
		    		 
   	     
		    			
   			 			
		  
  	   
   		 				
		    	  	
   			  	 
		    	 	 
   		 		  
		    	 		
   		  
	  
		    		  
   	    	
		    		 	
   		 	
		    			 
   	 	 
		    				
    
	
	     
empty-line
    	
empty-line
 			 
empty-line
	  	 
	
     	
	   
empty-line
  	
empty-line
   	 
empty-line
empty-line/EOF

[edit] XS programming language

<print>Hello, world!</print>

[edit] DUNNBOL1

A code language that draws in binary on a braille plotter (note that this is just the word HELLO).

BGN GRPLOT BIN
DRAWPLOT

00000000000000000000000000000000000000000000000000000000
00111001110011111110011100000000111000000000011111000000
00010000100001000010001000000000010000000000100000100000
00010000100001000000001000000000010000000000100000100000
00011111100001111000001000000000010000000000100000100000
00010000100001000000001000000000010000000000100000100000
00010000100001000010001000000000010000000000100000100000
00111001110011111110011111111000111111110000011111000000
00000000000000000000000000000000000000000000000000000000

ENDDRAW
END

---
Source: http://en.wikibooks.org/wiki/Transwiki:List_of_hello_world_programs

2 thoughts on “IT Updates: List of hello world programs

  1. Pingback: the parrott squawk » Blog Archive » Programming/Development Tips for Beginners: Introduction

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s