Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Computer Programming/Hello world

From Wikibooks, open books for an open world
<Computer Programming
A Wikibookian believes this page should be split into smaller pages with a narrower subtopic.

You can help by splitting this big page into smaller ones. Please make sure to follow thenaming policy. Dividing books into smaller sections can provide more focus and allow each one to do one thing well, which benefits everyone.

You can ask for help in dividing this book in theassistance reading room.

Wikipedia has related information atHello world program

The following is a list ofHello, 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" does not run, one must not try to develop complex programs before fixing the issues with the installation.

For even more languages have a look at theHello World Collection.

4DOS batch

[edit |edit source]

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

@echo Hello, world!

Ingres 4GL

[edit |edit source]
message "Hello, world!" with style = popup;

ABAP/4 - SAP AG

[edit |edit source]
REPORTZHELLO.START-OF-SELECTION.WRITE"Hello, world!".

ABAP Objects (NetWeaver 7)

[edit |edit source]

The example below makes use of the singleton pattern and outputs the text in a message box instead of a classic list output.

REPORTZHELLO.CLASSlcl_helloDEFINITIONCREATE PRIVATEFINAL.PUBLIC SECTION.CLASS-DATAselfTYPE REF TOlcl_helloREAD-ONLY.CLASS-METHODSclass_constructor.METHODSsay_hello.PRIVATE SECTION.CONSTANTScon_hello_worldTYPEcLENGTH13VALUE'Hello, World!'.ENDCLASS.CLASSlcl_helloIMPLEMENTATION.METHODclass_constructor.CREATE OBJECTlcl_hello=>self.ENDMETHOD.METHODsay_hello.MESSAGEcon_hello_worldTYPE'I'.ENDMETHOD.ENDCLASS.START-OF-SELECTION.lcl_hello=>self->say_hello().

ABC

[edit |edit source]
WRITE "Hello, world!"

ActionScript

[edit |edit source]

ActionScript 1.0 and 2.0

[edit |edit source]

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

trace("Hello, world!");

This version will be visible to the end user.

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

ActionScript 3

[edit |edit source]
package{publicclassHelloWorld{publicfunctionHelloWorld(){trace("Hello, world!");}}}

Ada

[edit |edit source]
withAda.Text_IO;procedureHelloisbeginAda.Text_IO.Put_Line("Hello, world!");endHello;

ALGOL 68

[edit |edit source]

The ALGOL 68 standard requires thatreserved-words,types andoperators are in a different typeface.Hence programs are typically published in eitherbold or anunderline typeface, e.g.:

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

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

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

or using awikitext like quote stropping, this is especially suitable on computers with only 6 bits per character (hence only have UPPERCASE):

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

or minimally using the "brief symbol" form ofbegin andend.

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

AmigaE

[edit |edit source]
PROC main()   WriteF('Hello, world!');ENDPROC

AMX NetLinx

[edit |edit source]

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

program_name = 'Hello'define_startsend_string 0,'Hello World!'

ANT

[edit |edit source]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE project><projectdefault="helloworld"><targetname="helloworld"><echomessage="Hello, World!"/></target></project>

APL

[edit |edit source]
RHWΔPGM[1]R'HELLO WORLD!'
  • 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 labeled 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ΔPGMHello, 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!!

AppleScript

[edit |edit source]
return"Hello, world!"

or:

display dialog"Hello, world!"

ASP

[edit |edit source]
<%Response.Write("Hello, world!")%>
or simply:
<%="Hello, world!"%>

ASP.NET

[edit |edit source]
// in the page behind using C#protectedvoidPage_Load(objectsender,EventArgse){Response.Write("Hello, world!");}
' in the page behind using VB.NETProtectedSubPage_Load(ByValsenderAsObject,ByValeAsEventArgs)Response.Write("Hello, world!")EndSub
//ASPXPageTemplate<asp:LiteralID="Literal1"runat="server"Text="Hello World!"></asp:Literal>

or

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

or

Hello World!

Assembly language

[edit |edit source]

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

[edit |edit source]

See theexample program in the WikipediaPDP-8 article.

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

[edit |edit source]
bdosequ0005H; BDOS entry pointstart:mvic,9; BDOS function: output stringlxid,msg$; address of msgcallbdosret; return to CCPmsg$:db'Hello, world!$'endstart

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

[edit |edit source]
10ORG#8000    ; Start address of the routine20STARTLDA,2; set the output channel30CALL#1601   ; to channel 2 (main part of TV display)40LDHL,MSG; Set HL register pair to address of the message50LOOPLDA,(HL); De-reference HL and store in A60ANDA; Null terminator?70RETZ; If so, return80RST#10      ; Print the character in A90INCHL; HL points at the next char to be printed100JRLOOP110RET120MSGDEFM"Hello, world!"130DEFB13; carriage return140DEFB0; null terminator

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

[edit |edit source]
A_CR=$0D;carriage returnBSOUT=$FFD2;kernel ROM sub, write to current output device;LDX#$00;starting index in .X register;LOOPLDAMSG,X;read message textBEQLOOPEND;end of text;JSRBSOUT;output charINXBNELOOP;repeat;LOOPENDRTS;return from subroutine;MSG.BYT'Hello, world!',A_CR,$00

Accumulator/Index microcoded machine: Data General Nova, RDOS

[edit |edit source]

See theexample section of the Nova article.

Expanded accumulator machine: Intel x86, DOS, TASM

[edit |edit source]
MODELSMALLIDEALSTACK100HDATASEGMSGDB'Hello, world!',13,'$'CODESEGStart:MOVAX,@dataMOVDS,AXMOVDX,OFFSETMSGMOVAH,09H; DOS: output ASCII$INT21HMOVAX,4C00HINT21HENDStart

ASSEMBLER x86 (DOS, MASM)

[edit |edit source]
.MODELSmall.STACK100h.DATAdbmsg'Hello, world!$'.CODEstart:movah,09hleadx,msg; or mov dx, offset msgint21hmovax,4C00hint21hendstart

ASSEMBLER x86 (DOS, FASM)

[edit |edit source]
; FASM example of writing 16-bit DOS .COM program; Compile: "FASM HELLO.ASM HELLO.COM"org$100use16movah,9movdx,xhelloint$21; DOS call: text outputmovah,$4Cint$21; Return to DOSxhellodb'Hello world !!!$'

Expanded accumulator machine: Intel x86, Microsoft Windows, FASM

[edit |edit source]

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

formatPEGUIentrystartsection'.code'codereadableexecutablestart:push0push_captionpush_messagepush0call[MessageBox]push0call[ExitProcess]section'.data'datareadablewriteable_captiondb'Win32 assembly program',0_messagedb'Hello, world!',0section'.idata'importdatareadablewriteabledd0,0,0,RVAkernel_name,RVAkernel_tabledd0,0,0,RVAuser_name,RVAuser_tabledd0,0,0,0,0kernel_table:ExitProcessddRVA_ExitProcessdd0user_table:MessageBoxddRVA_MessageBoxAdd0kernel_namedb'KERNEL32.DLL',0user_namedb'USER32.DLL',0_ExitProcessdw0db'ExitProcess',0_MessageBoxAdw0db'MessageBoxA',0section'.reloc'fixupsdatareadablediscardable

Using FASM import macro, unicode (MessageBoxW is one of few unicode functions 'supported' by Windows 9x/ME) and section sharing, no relocation (not required for 32-bit Windows NT executables, recommended for DOS-based Windows,required for x64), no heap - Not a beginners example but only 1024 instead of 3072 bytes:

formatPEGUI4.0heap0entrystartinclude'win32a.inc'section'.text'codeimportreadableexecutabledatalibrarykernel,'KERNEL32.DLL',\user,'USER32.DLL'importkernel,\ExitProcess,'ExitProcess'importuser,\MessageBoxW,'MessageBoxW'start:xorebx,ebxpushebxpushebxpush_messagepushebxcall[MessageBoxW]pushebxcall[ExitProcess]_messagedu'Hello, world!',0section'.reloc'fixupsdatareadablediscardable

Expanded accumulator machine: Intel x86, Linux, FASM

[edit |edit source]
formatELFexecutableentry_start_start:moveax,4movebx,1movecx,msgmovedx,msg_lenint80hmovebx,0moveax,1int80hmsgdb'Hello, world!',0xAmsg_len=$-msg

Expanded accumulator machine: Intel x86, Linux, GAS

[edit |edit source]
.datamsg:.ascii"Hello, world!\n"len=.-msg.text.global_start_start:movl$len,%edxmovl$msg,%ecxmovl$1,%ebxmovl$4,%eaxint$0x80movl$0,%ebxmovl$1,%eaxint$0x80

Expanded accumulator machine: Intel x86, Linux, NASM

[edit |edit source]
section.datamsgdb'Hello, world!',0xAlenequ$-msgsection.textglobal_start_start:movedx,lenmovecx,msgmovebx,1moveax,4int0x80movebx,0moveax,1int0x80

Expanded accumulator machine: Intel x86, Linux, GLibC, NASM

[edit |edit source]
externprintf; Request symbol "printf".globalmain; Declare symbol "main".section.datastr:DB"Hello World!",0x0A,0x00section.textmain:PUSHstr; Push string pointer onto stack.CALLprintf; Call printf.POPeax; Remove value from stack.MOVeax,0x0; \_Return value 0.RET; /

General-purpose fictional computer: MIX, MIXAL

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

General-purpose fictional computer: MMIX, MMIXAL

[edit |edit source]
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

General-purpose-register CISC: DEC PDP-11

[edit |edit source]

RT-11, MACRO-11

[edit |edit source]
.MCALL.REGDEF,.TTYOUT,.EXIT.REGDEFHELLO:MOV#MSG,R1MOVB(R1)+,R0BEQEXITLOOP:.TTYOUTBRLOOPEXIT:.EXITMSG:.ASCIZ/Hello,world!/.ENDHELLO

Variant for Elektronika BK using BIOS function, MICRO-11

[edit |edit source]
MOV#TXT,R1              ;Moving string address to R1CLRR2;String length=0, means null will be the termination characterEMT20;Print the stringHALTTXT:.ASCIZ/Hello,world!/.END

CISC Amiga (Workbench 2.0): Motorola 68000

[edit |edit source]
includelvo/exec_lib.iincludelvo/dos_lib.i; open DOS librarymovea.l4.w,a6leadosname(pc),a1moveq#36,d0jsr_LVOOpenLibrary(a6)movea.ld0,a6; actual print stringleahellostr(pc),a0move.la0,d1jsr_LVOPutStr(a6); close DOS librarymovea.la6,a1movea.l4.w,a6jmp_LVOCloseLibrary(a6)dosnamedc.b'dos.library',0hellostrdc.b'Hello, world!',0

CISC Atari: Motorola 68000

[edit |edit source]
;printmove.l#Hello,-(A7)move.w#9,-(A7)trap#1addq.l#6,A7;wait for keymove.w#1,-(A7)trap#1addq.l#2,A7;exitclr.w-(A7)trap#1Hellodc.b'Hello, world!',0

CISC Sharp X68000 (Human68K): Motorola 68000

[edit |edit source]
pea(strign); push string address onto stackdc.w$FF09; call DOS "print" by triggering an exceptionaddq.l#4,a7    ; restore the stack pointerdc.w$FF00; call DOS "exit"strign:dc.b"Hello, world!",13,10,0

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

[edit |edit source]
.titlehello.psectdata,wrt,noexechan:.blkw1iosb:.blkq1term:.ascid"SYS$OUTPUT"msg:.ascii"Hello, world!"len=.-msg.psectcode,nowrt,exe.entryhello,^m<>; Establish a channel for terminal I/O$assign_sdevnam=term,-chan=chanblbcr0,end; Queue the I/O request$qiow_schan=chan,-func=#io$_writevblk, -iosb=iosb,-p1=msg,-p2=#len; Check the status and the IOSB statusblbcr0,endmovzwliosb,r0; Return to operating systemend:ret.endhello

Mainframe: IBM z/Architecture series using BAL

[edit |edit source]
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

RISC processor: ARM, RISC OS, BBC BASIC's in-line assembler

[edit |edit source]
.programADRR0,messageSWI"OS_Write0"SWI"OS_Exit".messageEQUS"Hello, world!"EQUB0ALIGN

or the even smaller version (from qUE);

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

RISC processor: MIPS architecture

[edit |edit source]
.datamsg:.asciiz"Hello, world!".align2.text.globlmainmain:la$a0,msgli$v0,4syscalljr$ra

RISC processor: PowerPC, Mac OS X, GAS

[edit |edit source]
.datamsg:.ascii"Hello, world!\n"len=.-msg.text.globl_main_main:lir0,4; writelir3,1; stdoutaddisr4,0,ha16(msg); high 16 bits of addressaddir4,r4,lo16(msg); low 16 bits of addresslir5,len; lengthsclir0,1; exitlir3,0; exit statussc

Sigma 6/7/8/9 METASYMBOL

[edit |edit source]
SYSTEMBPMSTARTM:PRINT(MESS,HW)M:EXITHWTEXTC'HELLOWORLD'ENDSTART

AutoHotkey

[edit |edit source]
MsgBox,Hello,world!

(The comma after the command name is optional.)

AutoIt

[edit |edit source]
MsgBox(0,'','Hello, world!')

Avenue (scripting language for ArcView GIS)

[edit |edit source]
MsgBox("Hello, world!","aTitle")

AWK

[edit |edit source]
BEGIN{print"Hello, world!"}

B

[edit |edit source]

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

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

Baan Tools

[edit |edit source]

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

3GL Format

[edit |edit source]
function main(){    message("Hello, world!")}

4GL Format

[edit |edit source]
choice.cont.process:on.choice:    message("Hello, world!")

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

Bash or sh

[edit |edit source]
echo'Hello, world!'

or

printf'Hello, world!\n'

or using the C preprocessor

#!/bin/bash#define cpp #cpp$02>/dev/null|/bin/bash;exit$?#undef cpp#define HELLO_WORLD echo "hello, world"HELLO_WORLD|tra-zA-Z

BASIC

[edit |edit source]

General

[edit |edit source]

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):

10PRINT"Hello, world!"20END

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.

BlitzBasic

[edit |edit source]
Print"Hello, world!"WaitKey

DarkBASIC

[edit |edit source]
PRINT"Hello, world!"

or

TEXT0,0,"Hello, world!"WAITKEY

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

FreeBasic

[edit |edit source]
PRINT"Hello World"SLEEPEND

or

PRINT"Hello World"

or

?"Hello World"

or

'without a newline?"Hello World";

CoolBasic

[edit |edit source]
AddText"Hello, world!"DrawScreenWaitKey

GW-BASIC

[edit |edit source]
10PRINT"Hello, World!"20END

Liberty BASIC

[edit |edit source]

To write to the main window:

print"Hello, world"

Or drawn in a graphics window:

nomainwinopen"Hello, world!"forgraphicsas#mainprint#main,"place 50 50"print#main,"\Hello, world!"print#main,"flush"wait

Microsoft Small Basic

[edit |edit source]
TextWindow.WriteLine("Hello, world!")

PBASIC

[edit |edit source]
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):

DOHIGH7'Make the 7th pin go high (turn the LED on)PAUSE500'Sleep for half a secondLOW7' Make the 7th pin go low (turn the LED off)PAUSE500'Sleep for half a secondLOOPEND

StarOffice/OpenOffice Basic

[edit |edit source]
submainprint"Hello, world!"endsub

PureBasic

[edit |edit source]
OpenConsole()PrintN("Hello, world!")Input()

or

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

or

Debug"Hello, World"

QB64

[edit |edit source]
PRINT "Hello, World"                                                                                                                                                                                                     END

Same for QBasic

TI-BASIC

[edit |edit source]

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

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

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

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

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

Visual Basic

[edit |edit source]
PublicSubMain()Debug.Print"Hello, world!"EndSub

or

PublicSubMain()MsgBox"Hello, world!"EndSub

or

PrivateSubForm_Activate()Print"Hello, world!"EndSub

Alternatively, copy this into a New Form:

PrivateSubForm_Click()Form1.HideDimHelloWorldAsNewForm1HelloWorld.Width=2500:HelloWorld.Height=1000:HelloWorld.Caption="Hello, world!":HelloWorld.CurrentX=500:HelloWorld.CurrentY=75HelloWorld.Show:HelloWorld.Font="Tahoma":HelloWorld.FontBold=True:HelloWorld.FontSize=12:HelloWorld.Print"Hello, world!"EndSub

Visual Basic .NET

[edit |edit source]
ModuleHelloWorldAppSubMain()System.Console.WriteLine("Hello, world!")EndSubEndModule

PICK/BASIC, DATA/BASIC, MV/BASIC

[edit |edit source]

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!"

Batch (MS-DOS)

[edit |edit source]
@echo Hello World!

or

@echo offsethellostring=Hello World!echo%hellostring%

or

@echo offecho Hello World!pauseexit

or

@echo Hello World!pauseexit

As a CGI file

[edit |edit source]
@echo offecho Content-type: text/plain>> sample.cgiecho.>> sample.cgiecho.>> sample.cgiecho Hello, world!>> sample.cgi

bc

[edit |edit source]
"Hello, world!"

or, with the newline

print"Hello, world!\n"

BCPL

[edit |edit source]
GET "LIBHDR"LET START () BE$(    WRITES ("Hello, world!*N")$)

BITGGAL AgileDog

[edit |edit source]
T  1 "Hello, World" 0

BITGGAL Jihwaja

[edit |edit source]
J( 1 TM 5 ZV 3 "Hello, world" )

BLISS

[edit |edit source]
%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;ENDELUDOM

BlitzMax

[edit |edit source]
SuperStrictGraphics640,480,0,60Localrunning:Int=1WhilerunningClsDrawText"Hello World!",1,1FlipIfGetChar()running=0EndIfWendEnd

boo

[edit |edit source]

See alsoGUI section.

print"Hello, world!"

Burning Sand 2

[edit |edit source]
WRITE ELEMENT:Earth 210 230 40 CENTER TEXT "Hello World!"

C

[edit |edit source]
#include<stdio.h>intmain(){printf("Hello, world!\n");return0;}

ANSI C

[edit |edit source]
#include<stdio.h>intmain(void){printf("Hello, World!\n");return0;}

Caché Server Pages (CSP)

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

Calprola

[edit |edit source]

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

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

C/AL - MBS Navision

[edit |edit source]
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.  }}

Casio FX-9750

[edit |edit source]

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

"Hello, world!"

or

Locate 1,1,"Hello, world!"

CCL

[edit |edit source]
 call echo("Hello, world!")

Ch

[edit |edit source]

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

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

Chuck

[edit |edit source]
 <<<"Hello World">>>;

Chrome

[edit |edit source]
namespace HelloWorld;interfacetype  HelloClass =classpublicclass method Main;end;implementationclass method HelloClass.Main;begin  System.Console.WriteLine('Hello, world!');end;end.

CIL

[edit |edit source]
.assemblyHello{}.assemblyexternmscorlib{}.methodstaticvoidMain(){.entrypoint.maxstack1ldstr"Hello, world!"callvoid[mscorlib]System.Console::WriteLine(string)ret}

CintieFramework (VisualBasic.NET)

[edit |edit source]
<Script><References><Reference>System.dll</Reference></References><CodeLanguage="VisualBasic"><![CDATA[Public Class PluginPublic Function MainF(ByVal Ob As Object) As String'Script CodeReturn "Hello, World!"End FunctionEnd Class]]></Code></Script>

Clean

[edit |edit source]
modulehelloStart="Hello, world!"

Clipper

[edit |edit source]
 ?"Hello, world!"

or

 @1,1 say"Hello, world!"

or

Qout("Hello, world")

CLIST

[edit |edit source]
PROC 0WRITE Hello, world!

Clojure

[edit |edit source]
(println"Hello, world!")

CLU

[edit |edit source]
start_up = proc ()    po: stream := stream$primary_output ()    stream$putl (po, "Hello, world!")    end start_up

COBOL

[edit |edit source]
IDENTIFICATIONDIVISION.PROGRAM-ID.HELLO-WORLD.PROCEDUREDIVISION.DISPLAY"Hello, world!".STOPRUN.

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

CoffeeScript

[edit |edit source]

CoffeeScript is a language that compiles into JavaScript. Like JavaScript, it does not have native (built in) input or output routines, instead relying on the facilities provided by its host environment.

Using an alert that uses a standard Web browser's window object (window.alert)

alert'Hello, world!'

or, fromFirebug,Apple Safari, orGoogle Chrome debug console, orNode.js console

console.log'Hello, world!'

ColdFusion (CFML)

[edit |edit source]
<cfoutput>Hello, world!</cfoutput>

or

Hello, world!

COMAL

[edit |edit source]
PRINT"Hello, world!"

Common Lisp

[edit |edit source]
(princ"Hello, world!")

Cube

[edit |edit source]
Function | Main  WriteLine | "Hello, world"End | Main

The '|' represents the separation of the two text fields in the Cube standard IDE.

C++

[edit |edit source]
#include<iostream>intmain(){std::cout<<"Hello, World!"<<std::endl;return0;}

C++/CLI

[edit |edit source]
intmain(){System::Console::WriteLine("Hello, world!");return0;}

C++, Managed (.NET)

[edit |edit source]
#using <mscorlib.dll>usingnamespaceSystem;intwmain(){Console::WriteLine("Hello, world!");return0;}

C#

[edit |edit source]

See alsoGUI section.

In C# 10.0, the following would suffice:

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

In C# 2.0, the code is much larger:

usingSystem;internalstaticclassHelloWorld{privatestaticvoidMain(){Console.WriteLine("Hello, world!");}}

D

[edit |edit source]
importstd.stdio;voidmain(){writefln("Hello, world!");}

Tango version:

importtango.io.Stdout;voidmain(){Stdout("Hello, world!").newline;}

Dart

[edit |edit source]
main(){print('Hello, world!');}

Or,

voidmain(){print('Hello, world!');}

DC, an arbitrary precision calculator

[edit |edit source]
[Hello, world!]p

or

1468369091346906859060166438166794P

In the second example, DC stores the decimal number as a sequence of bits, and then the "P" tells DC to interpret those bits as a string and print it.

DCL batch

[edit |edit source]
$ write sys$output "Hello, world!"

Delphi

[edit |edit source]
{$APPTYPE CONSOLE}beginWrite('Hello, world!');end.

DIV

[edit |edit source]
PROGRAMhello;BEGINwrite(0,0,0,0,"Hello,world!");LOOPFRAME;ENDEND

DOLL

[edit |edit source]
this::operator(){ import system.cstdio; puts("Hello, world!");}

Dream Maker

[edit |edit source]
mob    Login()        ..()        world << "Hello, world!"

Dylan

[edit |edit source]
module:helloformat-out("Hello, world!\n");

EAScripting

[edit |edit source]
set disp to "Hello, world!"set dispto to item unit 5 //5 = default screenrelease disp into dispto.

This would be a pure system call

import system ea.helloworldwait

Ed and Ex (Ed extended)

[edit |edit source]
aHello, world!!.p

Ecstasy (xtclang)

[edit |edit source]
moduleHelloWorld{voidrun(){@InjectConsoleconsole;console.print("Hello World!");}}

Eiffel

[edit |edit source]
classHELLO_WORLDcreatemakefeaturemakeisdoio.put_string("Hello, world!%N")end-- makeend-- class HELLO_WORLD

Elixir

[edit |edit source]
IO.puts"Hello, world!"

Elm

[edit |edit source]
importHtmlexposing(text)main=text"Hello, World!"

Erlang

[edit |edit source]

See alsoGUI section.

-module(hello).-export([hello/0]).hello()->io:format("Hello, world!~n").

Euphoria

[edit |edit source]
puts(1, "Hello, world!")

Factor

[edit |edit source]
"Hello, world!"print

or gui version

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

Falcon

[edit |edit source]
printl( "Hello world" )

Ferite

[edit |edit source]
uses "console";Console.println("Hello, world!");

filePro

[edit |edit source]
 @once:   mesgbox "Hello, world!" ; exit

Fjölnir

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

FOCAL

[edit |edit source]
type "Hello, world!",!

or

t "Hello, world!",!

Focus

[edit |edit source]
-TYPE Hello, world!

Forte TOOL

[edit |edit source]
begin TOOL HelloWorld;includes Framework;HAS PROPERTY IsLibrary = FALSE;forward  Hello;-- START CLASS DEFINITIONSclass Hello inherits from Framework.Objecthas 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.Initbeginsuper.Init();task.Part.LogMgr.PutLine('Hello, world!');end method;-- END METHOD DEFINITIONSHAS PROPERTY    CompatibilityLevel = 0;    ProjectType = APPLICATION;    Restricted = FALSE;    MultiThreaded = TRUE;    Internal = FALSE;    LibraryName = 'hellowor';    StartingMethod = (class = Hello, method = Init);end HelloWorld;

Forth

[edit |edit source]
: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

Fortran

[edit |edit source]

Fortran 77

[edit |edit source]
00programhellowrite(*,*)'Hello World!'stop      end

Fortran 90/95

[edit |edit source]
programhellowrite(*,*)'Hello, World!'end programhello

F#

[edit |edit source]
printfn"Hello, world!"

Fril

[edit |edit source]
?((pp "Hello, world!"))

or

pp "Hello, world!"

Frink

[edit |edit source]
println["Hello, world!"]

Gambas

[edit |edit source]

See alsoGUI section.

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

GEMBase 4GL

[edit |edit source]
procedure_form hello  begin_block world      print "Hello, world!"  end_blockend_form

GeneXus

[edit |edit source]
Msg("Hello World")


GML (Game Maker Language)

[edit |edit source]

In the draw event of some object:

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

Or to show a splash screen message:

 show_message("Hello, world!")

Go (from Google)

[edit |edit source]
packagemainimport"fmt"funcmain(){fmt.Println("Hello, world!")}

GraalScript

[edit |edit source]

GraalScript 1

[edit |edit source]
 if (created) {   echo Hello, world!; }

GraalScript 2

[edit |edit source]
 function onCreated() {   echo("Hello, world!"); }

Groovy

[edit |edit source]
println"Hello, world!"

Harbour

[edit |edit source]
? "Hello, world!"

or

@1,1 say "Hello, world!"

or

Qout("Hello, world")

Haskell

[edit |edit source]
main=putStrLn"Hello, world!"

Haxe

[edit |edit source]
classHelloWorldApp{staticfunctionmain(){trace("Hello, world!");}}

Heron

[edit |edit source]
program HelloWorld;functions {  _main() {    print_string("Hello, world!");  }}end

HP 33s

[edit |edit source]

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

LBL HSF 10EQNRCL HRCL ERCL LRCL LRCL OR/SRCL WRCL ORCL RRCL LRDL DENTERR/S

HP-41 & HP-42S

[edit |edit source]

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

01 LBLTHELLO02THello, world!03 PROMPT

HyperTalk (Apple HyperCard's scripting programming language)

[edit |edit source]
put"Hello, world!"

or

Answer"Hello, world!"

Icon

[edit |edit source]
proceduremain()write("Hello, world!")end

IDL

[edit |edit source]
print,"Hello, world!"

Io

[edit |edit source]
"Hello, world!"println

or

writeln("Hello, world!")

Inform

[edit |edit source]

Inform 5/6

[edit |edit source]
[Main;"Hello, world!";];

Inform 7

[edit |edit source]
 Hello World is a room.  The printed name is"Hello, world!"

Iptscrae

[edit |edit source]
ON ENTER {    "Hello, " "world!" & SAY}

J

[edit |edit source]
'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

Jal

[edit |edit source]
include 16f877_20include 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 = "!"

Java

[edit |edit source]

See alsoGUI section.

classHelloWorld{publicstaticvoidmain(String[]args){System.out.println("Hello, world!");}}

Java byte-code

[edit |edit source]

(disassembler output ofjavap -c HelloWorld)

publicclassHelloWorldextendsjava.lang.Object{publicHelloWorld();Code:0:aload_01:invokespecial#1;//Method java/lang/Object."<init>":()V4:returnpublicstaticvoidmain(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;)V8:return}

Java byte-code Jasmin Syntax

[edit |edit source]
.classHelloWorld.superjava/lang/Object.methodpublicstaticmain([Ljava/lang/String;)V.limitstack2getstaticjava/lang/System/outLjava/io/PrintStream;ldc"Hello, world!"invokevirtualjava/io/PrintStream/println(Ljava/lang/String;)Vreturn.endmethod

JavaFX Script

[edit |edit source]

JavaFX Script was a scripting language formerly called F3 for Form Follows Function. It was discontinued by Oracle in 2010.

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

This program can also be written in this way:

varwin=newFrame();win.title="Hello World JavaFX";win.width=200;varlabel=newLabel();label.text="Hello World";win.content=label;win.visible=true;

A simple console output version would be:

importjava.lang.System;System.out.println("Hello World");

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

println("Hello World");

JavaScript

[edit |edit source]

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.write('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 theWindows Script Host

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

or, fromFirebug,Apple Safari, orGoogle Chrome debug console

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

JCL (mainframe Job Control Language)

[edit |edit source]
//HERIBJOB,'HERIBERT OTTEN',PRTY=12//* HELLO WORLD FOR MVS//HALLOEXECPGM=IEBGENER//SYSIN    DDDUMMY//SYSPRINT DDSYSOUT=*//SYSUT2   DDSYSOUT=T//SYSUT1   DD*HELLO WORLD!/*//

Joy

[edit |edit source]
"Hello, world!\n" putchars .

JSP

[edit |edit source]
<%@pagecontentType="text/html;charset=WINDOWS-1252"%><HTML><BODY><%out.println(" Hello, world!");%></BODY></HTML>

or just

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

or literally

 Hello, world!

Julia

[edit |edit source]
println("Hello, world!")

K

[edit |edit source]
`0:"Hello, world!\n"

ksi

[edit |edit source]
`plain'Hello World!' #echo #

Kotlin

[edit |edit source]
funmain(){println("Hello World!")}


Kogut

[edit |edit source]
WriteLine "Hello, world!"

KPL (Kids Programming Language)

[edit |edit source]
Program HelloWorld   Method Main()      ShowConsole()      ConsoleWriteLine("Hello, world!")   End MethodEnd Program

Lasso

[edit |edit source]
Output:'Hello, world!';

or

Output('Hello, world!');

or simply

'Hello, world!';

Lexico Mobile (in Spanish)

[edit |edit source]
tarea muestre "Hola mundo !"

or

clase Saludo derivada_de FormpublicosmensajesSaludo copie "Hola mundo !" en saludo.Text

Linden Scripting Language

[edit |edit source]

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!");}}

Linotte

[edit |edit source]
Livre : HelloWorld Paragraphe : Affichage Actions :   "Hello, World !" !

Lisaac

[edit |edit source]
SectionHeader+name:=HELLO_WORLD_PROGRAM;SectionPublic-main<-  ("Hello world!\n".print;  );

Lisp

[edit |edit source]

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

Common Lisp

[edit |edit source]
(formatt"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.)

Scheme

[edit |edit source]
(display"Hello, world!\n")

Clojure

[edit |edit source]
(println"Hello, world!")

Emacs Lisp

[edit |edit source]
(print"Hello, world!")

or:

(message"Hello, world!")

AutoLisp

[edit |edit source]
(print"Hello, world!")

XLISP

[edit |edit source]
(print"Hello, world!")

Arc

[edit |edit source]
(prn"Hello, world!")

Pils

[edit |edit source]
(out"Hello, world!")

Logo

[edit |edit source]
print [Hello, world!]

or

pr [Hello, world!]

In MSWLogo only

messagebox [Hi] [Hello, world!]

LPC

[edit |edit source]
voidcreate(){write("Hello, world!\n");}

Lua

[edit |edit source]
io.write("Hello, world!\n")

or

return"Hello, World!"

or

print("Hello, world")

LuaDEV (PSP and Wii)

[edit |edit source]
screen.print(10,10,"Hello, world!")

M (MUMPS)

[edit |edit source]
W "Hello, world!"

Macsyma, Maxima

[edit |edit source]
print("Hello, world!")$

Maple

[edit |edit source]
 print("Hello, world!");

Mathematica

[edit |edit source]
Print["Hello, world!"]

or simply:

"Hello, world!"

MATLAB / GNU Octave

[edit |edit source]
disp('Hello, world!')

or

fprintf('Hello, world!\n')

or with a GUI

figure('Position',[100100200200],'MenuBar','none','Name','Hello World');uicontrol('Style','text','Position',[1510015015],'String','Hello world');

or

msgbox('Hello World!')

Maude

[edit |edit source]
fmod HELLOWORLD isprotecting STRING .  op helloworld : -> String .  eq helloworld = "Hello, world!" .endfmred helloworld .

Max

[edit |edit source]
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;

Maya Embedded Language

[edit |edit source]
print("Hello, world!\n");

Mesham

[edit |edit source]
var x:String::allocated[on[0]];x:="Hello World";  // allocated on process 0 onlyproc 1 {   // This is displayed by process 1, auto communication done to achieve this   print[x];}

M4

[edit |edit source]
Hello, world!

Microbit

[edit |edit source]

mIRC Script

[edit |edit source]

aliases

[edit |edit source]
helloworld echo Hello, world!

remote

[edit |edit source]
alias helloworld echo Hello, world!

popups

[edit |edit source]
Hello World:echo Hello, world!

command line

[edit |edit source]
echo Hello, world!

Model 204

[edit |edit source]
BEGINPRINT 'Hello, world!'END

Modula-2

[edit |edit source]
MODULEHello;FROMInOutIMPORTWriteLn,WriteString;BEGINWriteString("Hello, world!");WriteLnENDHello.

Monkey

[edit |edit source]
StrictFunctionMain:Int()Print"Hello World!"Return0End

MOO

[edit |edit source]

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!");

Mouse

[edit |edit source]
"Hello, World!"$

MPI

[edit |edit source]
#include<stdio.h>#include<time.h>#include<string.h>#include"mpi.h"intmain(intargc,char*argv[]){constintmaximum_message_length=100;constintmaster_rank=0;charmessage[maximum_message_length+1];MPI_Statusstatus;/* Info about receive status  */intmy_rank;/* This process ID            */intnum_procs;/* Number of processes in run */intsource;/* Process ID to receive from */intdestination;/* Process ID to send to      */inttag=0;/* Message ID                 */intmpi_error;/* Error code for MPI calls   */inticount;charprocessor_name[MPI_MAX_PROCESSOR_NAME];intname_length;// Initialize the MPI execution environment.mpi_error=MPI_Init(&argc,&argv);if(mpi_error!=MPI_SUCCESS){fprintf(stderr,"Error: %s: Unable to initialize MPI execution environment\nAborting ...\n",argv[0]);return(1);}// Even though we capture the error value from the MPI calls, we will// not deal with any error except the last one.mpi_error=MPI_Comm_rank(MPI_COMM_WORLD,&my_rank);mpi_error=MPI_Comm_size(MPI_COMM_WORLD,&num_procs);if(my_rank!=master_rank){mpi_error=MPI_Get_processor_name(processor_name,&name_length);sprintf(message,"Greetings from process #%d running on %s\n",\my_rank,processor_name);destination=master_rank;mpi_error=MPI_Send(message,strlen(message)+1,MPI_CHAR,\destination,tag,MPI_COMM_WORLD);}else{for(source=0;source<num_procs;source++){if(source!=master_rank){mpi_error=MPI_Recv(message,maximum_message_length+1,\MPI_CHAR,source,tag,MPI_COMM_WORLD,&status);printf("%s\n",message);}}}mpi_error=MPI_Finalize();if(MPI_SUCCESS!=mpi_error)return(mpi_error);elsereturn(0);}

M# Fictional Computer Language

[edit |edit source]

Script

[edit |edit source]
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   //}

Command WI

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

Command WoI

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

MS-DOS batch

[edit |edit source]

(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 offclsecho Hello, world!

MUF

[edit |edit source]
: main  me @ "Hello, world!" notify;

Natural

[edit |edit source]
WRITE 'Hello, world!'END

or

WRITE 'Hello, world!'.

Neko

[edit |edit source]
$print("Hello, world!!\n");

Nemerle

[edit |edit source]

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:

usingSystem.Console;moduleHelloWorld{Main():void{WriteLine("Hello, world!");}}

Nim

[edit |edit source]
echo"Hello, world!"

or

echo("Hello, world!")

NXT 2.1 (the Lego Robot program)

[edit |edit source]

Oberon

[edit |edit source]

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

Program written for the Oberon operating system:

MODULEHello;IMPORTOberon,Texts;VARW:Texts.Writer;PROCEDUREWorld*;BEGINTexts.WriteString(W,"Hello, world!");Texts.WriteLn(W);Texts.Append(Oberon.Log,W.buf)ENDWorld;BEGINTexts.OpenWriter(W)ENDHello.

Freestanding Oberon program using the standard Oakwood library:

MODULEHello;IMPORTOut;BEGINOut.String("Hello, world!");Out.LnENDHello.

Obix

[edit |edit source]
system.console.write_line ( "Hello, world!" )

ObjectGears

[edit |edit source]

Message to the user in the form:

OGForm.SetInfo('Hello world!');

Entry into the log:

OG.Log.Write('Hello world!');

Objective C

[edit |edit source]

Procedural C Version

[edit |edit source]
#import <stdio.h>intmain(intargc,constchar*argv[]){printf("Hello, world!\n");return0;}

Object-Oriented C Version

[edit |edit source]
#import <stdio.h>#import <objc/Object.h>@interfaceHello :Object{}-hello;@end@implementationHello-hello{printf("Hello, world!\n");}@endintmain(void){idobj;obj=[Hellonew];[objhello];[objfree];return0;}

OPENSTEP/Cocoa Version

[edit |edit source]
#import <Foundation/Foundation.h>intmain(intargc,constchar*argv[]){NSLog(@"Hello, world!");return0;}

OCaml

[edit |edit source]
print_endline"Hello, world!";;

occam

[edit |edit source]
#USE "course.lib"PROC hello.world(CHAN OF BYTE screen!)  out.string("Hello, world!*n", 0, screen!):

or without usingcourse.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':

OpenScript

[edit |edit source]
-- in a popup windowrequest "Hello world"

OPL

[edit |edit source]

See alsoGUI section.

PROC hello:  PRINT "Hello, world!"ENDP

OPS5

[edit |edit source]
(object-classrequest^action)(startup(strategyMEA)(makerequest^actionhello))(rulehello(request^actionhello)(write|Hello, world!|(crlf)))

OPS83

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

Oz

[edit |edit source]
{Browse 'Hello, world!'}

Parrot assembly language

[edit |edit source]
print"Hello, world!\n"end

Parrot intermediate representation

[edit |edit source]
 .subhello :mainprint"Hello, world!!\n" .end

Pascal

[edit |edit source]
beginwrite('Hello, world!');end.

PAWN

[edit |edit source]
main() {print("Hello, World!");}

or

main() {new string[14];format string(sizeof(string),"Hello, World!);print(string);}

Perl

[edit |edit source]

As PL file

[edit |edit source]
print"Hello, world!\n";

(the semicolon is optional)

or

packageHello;subnew(){bless{}}subHello(){print"Hello, world! \n"}packagemain;my$hello=Hello->new();$hello->Hello();

As CGI file

[edit |edit source]
#!/usr/local/bin/perlprint"Content-type: text/html\n\n";print"<H1>Hello World!</H1>";

Phix

[edit |edit source]
puts(1, "Hello, world!")

PHP

[edit |edit source]

PHP is a templating language and will echo any text not within PHP tags directly, so the simplest form is:

Hello,world!

Using actual PHP statements, it can be written:

<?phpecho'Hello, world!';?>

or use short-hand echoing, syntaxed as such:

<?echo"Hello, world!"?>

this will also work:

<?="Hello, world!"?>

Pike

[edit |edit source]
intmain(){write("Hello, world!\n");return0;}

PILOT

[edit |edit source]
T:Hello, world!

PL/SQL

[edit |edit source]
setserveroutputonsize1000000;-- this is a SQL*Plus command to enable the output bufferbegindbms_output.put_line('Hello, world!');end;

PL/I

[edit |edit source]
Test:procoptions(main);putlist('Hello, world!');endTest;

PostScript

[edit |edit source]

See alsopage description language section.

(Hello, world!\n)print

PowerShell

[edit |edit source]
"Hello, world!"

or

Write-Host"Hello, world!"

or

echo"Hello, world!"

or

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

or

[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')[System.Windows.Forms.MessageBox]::Show("Hello, World!")

Processing

[edit |edit source]
println("Hello, world!");

Progress 4GL

[edit |edit source]
display"Hello, world!".

Prolog

[edit |edit source]
:-write('Hello, world!'),nl.

Pure Data

[edit |edit source]
#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;

Python

[edit |edit source]

As a script/module

[edit |edit source]

Python 2 and earlier

[edit |edit source]
print"Hello, world!"

Python 3

[edit |edit source]
print("Hello, world!")

This also works on Python 2.4 or later, but in an unintuitive way. In Python 3, it calls theprint function with the string"Hello, world!". In Python 2, it executes theprint statement with the expression("Hello, world!"), which evaluates to the string"Hello, world!".

Any Python version

[edit |edit source]
importsyssys.stdout.write("Hello, world!\n")

In Python 2.6 or later:

from__future__importprint_functionprint("Hello, world!")

Two easter eggs

[edit |edit source]
import__hello__import__phello__

Using Curves

[edit |edit source]
frommathimportcos,sindeff(x):returnint(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))forxinrange(12)]))

In the REPL

[edit |edit source]

'Hello, world!' (with quotation marks) can be attained through:

'Hello, world!'

As CGI file

[edit |edit source]
#!/usr/local/bin/pythonprint("Content-type: text/html\n\n")print("Hello World!")

Flask

[edit |edit source]

As Python's Flask web microframework

fromflaskimportFlaskapp=Flask(__name__)@app.route("/")defhello():return"Hello World!"app.run()

R

[edit |edit source]
print('Hello, world!')

Raku

[edit |edit source]
"Hello, world!".say

or

say"Hello, world!";

or

print"Hello, world!\n";

Rebol

[edit |edit source]

See alsoGUI section.

print "Hello, world!"

Red

[edit |edit source]

See alsoGUI section.

print "Hello, world!"

Redcode

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

REFAL

[edit |edit source]
$ENTRY GO{=<Prout 'Hello, world!'>;}

Revolution

[edit |edit source]

(This works the same for Transcript or xTalk)

Printed in the message box

[edit |edit source]
put "Hello, World!"

Shown within a dialog box

[edit |edit source]
answer "Hello, world!"

Printed on the main window interface

[edit |edit source]
createfield"myField"setthetextoffield"myField"to"Hello, world!"

As CGI file

[edit |edit source]
#!revolution on startup   put "Content-Type: text/plain" & cr & cr   put "Hello World!" end startup

REXX, ARexx, NetRexx, and Object REXX

[edit |edit source]
/* a starting comment is needed in mainframe versions */say"Hello, world!"

Ring

[edit |edit source]
 see "hello world!"

RPG

[edit |edit source]

Free-Form Syntax

[edit |edit source]
/FREE    DSPLY 'Hello, world!';    *InLR = *On;/END-FREE

Traditional Syntax

[edit |edit source]

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

RPG Code

[edit |edit source]

Message Window

[edit |edit source]

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

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

On Screen Text

[edit |edit source]

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

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

RPL

[edit |edit source]

See alsoGUI section.

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

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

RT Assembler

[edit |edit source]
_name   Hello~World!pause   Hello~World!exit_end

Ruby

[edit |edit source]

See alsoGUI section.

puts'Hello, world!'

or

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

or

classStringdefsayputsselfendend'Hello, world!'.say

Rust

[edit |edit source]
fnmain(){println!("Hello, world!");}

S (and R)

[edit |edit source]
print("Hello, world")

or

message("Hello, world")

S-Lang

[edit |edit source]
message("Hello, world!");

SAS

[edit |edit source]
%putHello, world!;

Sather

[edit |edit source]
class HELLO_WORLD is  main is    #OUT+"Hello, world!\n";   end; end;

Scala

[edit |edit source]
objectHelloWorldextendsApp{println("Hello, world!")}

App was introduced since Scala 2.1, andApplication was deprecated since Scala 2.9.0. UseApplication instead ofApp for versions below 2.1.

SCAR

[edit |edit source]
programHelloWorld;beginWriteLn('Hello world!');end.

Scheme

[edit |edit source]
(display"Hello, World!")(newline)

Scratch

[edit |edit source]

sed

[edit |edit source]

(Note: requires at least one line of input)

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

Seed7

[edit |edit source]
$ include "seed7_05.s7i";const proc: main is func  begin    writeln("Hello, world");  end func;

Self

[edit |edit source]
'Hello, world!' print.

sense script

[edit |edit source]
out('Hello, world!');

ShadowScript

[edit |edit source]
'set up initial variablesstruct.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 windowopen 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)>'endend.end/

Simula

[edit |edit source]
BEGIN    OutText("Hello, world!");    OutImage;END

Smalltalk

[edit |edit source]
Transcriptshow:'Hello, world!'

alternative:

StdoutStreamnextPutLine:'Hello, world'

SML

[edit |edit source]
print"Hello, world!\n";

SNOBOL

[edit |edit source]
OUTPUT="Hello, world!"END

Span

[edit |edit source]
class Hello {  static public main: args {    Console << "Hello, world!\n";  }}

SPARK

[edit |edit source]
withSpark_IO;--# inherit Spark_IO;--# main_program;procedureHello_World--# global in out Spark_IO.Outputs;--# derives Spark_IO.Outputs from Spark_IO.Outputs;isbeginSpark_IO.Put_Line(Spark_IO.Standard_Output,"Hello, world!",0);endHello_World;

Spin

[edit |edit source]

Spin is the high level language from Parallax Inc. used to program their Propeller multi-core micro-controllers.

The program assumes that the software UART object, provided with the Propeller IDE, is used to deliver the message over a serial line.

CON    _clkmode = xtal1 + pll16x    _xinfreq = 5_000_000OBJ    console : "FullDuplexSerial"PUB start    console.start(31, 30, 0, 115_200)    console.str(string("Hello, world!", 13))

SPITBOL

[edit |edit source]
OUTPUT="Hello, world!"END

SPSS Syntax

[edit |edit source]
ECHO "Hello, world!".

SSPL

[edit |edit source]
1.0print Hello, World!end

Standard ML

[edit |edit source]
print"Hello, world!\n";

SQL

[edit |edit source]
SELECT'Hello, world!'

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

BEGINDBMS_OUTPUT.PUT_LINE('Hello, world!');END;

or (e.g. Oracle dialect)

SELECT'Hello, world!'FROMdual;

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

BEGINDBMS_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)

CREATEFUNCTIONhello_world()RETURNStextAS$$BEGINRETURN'Hello, world!';END$$LANGUAGEplpgsql;

or (e.g. T-SQL dialect)

PRINT'Hello, world!'

or (for KB-SQL dialect)

selectNullfromDATA_DICTIONARY.SQL_QUERYFOOTER''orHEADERorDETAILorFINALevent''write"Hello, world!"

STARLET

[edit |edit source]
RACINE: HELLO_WORLD.NOTIONS:HELLO_WORLD : ecrire("Hello, world!").

Stata

[edit |edit source]

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!"

SuperCollider

[edit |edit source]
"Hello, world!".postln;

or, for interactive prompt,

"Hello, world!"

Supernova

[edit |edit source]
I want window and the window title is hello world.

Swift

[edit |edit source]
println("Hello, world!")// Swift 1.xprint("Hello, world!")// Swift 2.x

TACL

[edit |edit source]
#OUTPUT Hello, world!

Tcl (Tool command language)

[edit |edit source]

See alsoGUI section.

puts"Hello, world!"

Template Toolkit

[edit |edit source]
[% GET "Hola mundo!"; %]

Or the English version:

[% GET "Hello world!"; %]

Thyme

[edit |edit source]
 print ("Hello, world!")

TOM (rewriting language)

[edit |edit source]
publicclassHelloWorld{%include{string.tom}publicfinalstaticvoidmain(String[]args){Stringwho="world";%match(Stringwho){"World"->{System.out.println("Hello, "+who+"!");}_->{System.out.println("Don't panic");}}}

TSQL

[edit |edit source]
Declare@Outputvarchar(16)Set@Output='Hello, world!'Select'Output'=@Output

or, simpler variations:

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

TTCN-3

[edit |edit source]
module hello_world {  control {    log("Hello, world!");  }}

Turing

[edit |edit source]
put "Hello world!"

UNIX-style shell

[edit |edit source]
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!'00

Vala

[edit |edit source]
usingGLib;publicintmain(string[]args){stdout.printf("Hello, world!\n");return0;}

Verilog

[edit |edit source]
modulemain();initialbegin#0$display("Hello, world!!");#1$finish;endendmodule

or (a little more complicated)

modulehello(clk);inputclk;always@(posedgeclk)$display("Hello, world!!");endmodulemodulemain();regclk;helloH1(clk);initialbegin#0clk=0;#5clk=1;#1$finish;endendmodule
modulehello(clk);inputclk;always@(posedgeclk)$display("Hello, world!!");endmodulemodulemain();regclk;helloH1(clk);initialbegin#0clk=0;#23$display("--23--");#100$finish;endalways#5clk=~clk;endmodule

VHDL

[edit |edit source]
usestd.textio.all;entityHelloisendHello;architectureHello_ArchofHelloisbeginp:processvariablel:line;beginwrite(l,String'("Hello, world!"));writeline(output,l);wait;endprocess;endHello_Arch;

Visual Basic Script

[edit |edit source]
WScript.Echo"Hello, world!"

OR as a VBscript file

MsgBox"Hello, world!"

Visual Prolog

[edit |edit source]
#include@"pfc\console\console.ph"goalconsole::init(),stdio::write("Hello, world!").

VRML (Virtual Reality Modeling Language)

[edit |edit source]
#X3D V3.3 utf8Shape{geometryText{string["hello, world"]}}

Web Assembly

[edit |edit source]
(module(type$type0(func(resulti32)))(table0anyfunc)(memory1)(export"memory"memory)(export"hello"$func0)(func$func0(resulti32)i32.const16)(data(i32.const16)"Hello World\00"))

X#

[edit |edit source]
sub:mainload:mscorlib.dllpush:Hello, World!invoke:mscorlib.dll:System.Console:Write:1endsub

X3D (Extensible 3D)

[edit |edit source]
<X3Dprofile='Immersive'version='3.3'><Scene><Shape><Textstring='"hello, world"'/></Shape></Scene></X3D>

XC

[edit |edit source]

XC is a C like language from XMOS Ltd offering features supporting Communicating Sequential Processes on their multi-threaded, multi-core processors.This example shows some of those features.

#include<platform.h>#define BIT_RATE 115200#define BIT_TIME XS1_TIMER_HZ / BIT_RATE// A one bit output port with bufferingoutport:1buffereduart_tx=PORT_UART_TX;// Thread implements serial transmitter using the ports timer.voidconsole(chanendc,outport:1bufferedTXD){unsignedtime;charbyte;while(1){c:>byte;// Read byte from the consol output channel.TXD<:0@time;// Set start bit and save IO time stamp.for(intj=0;j<8;j+=1)// Data bits.{time+=BIT_TIME;// Time of next bit.TXD@time<:>>byte;// Shift out next bit on time.}time+=BIT_TIME;// Two stop bitsTXD@time<:1;time+=BIT_TIME;TXD@time<:1;}}// Thread issues greeting message to the consolevoidgreeter(chanendc){charmsg[]="Hello World!\n";inti;while(1)// Repeatedly send message to console output channel.{for(i=0;i<sizeof(msg)-1;i++){c<:msg[i];// Output a byte to the channel.}}}intmain(){chanc;// Communication channel between threads.par// Parallel execution of block statements.{onstdcore[0]:console(c,uart_tx);// Run console output thread on core 0.onstdcore[1]:greeter(c);// Run greeter thread or core 1.}return0;}

XL

[edit |edit source]
   use XL.UI.CONSOLE   WriteLn "Hello, world!"

or

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

XMLmosaic

[edit |edit source]
<Class><Type>XMLmosaicClass</Type><Method><Nameid="1">Main</Name><Codeid="1">voidMain(){Console.WriteLine('HelloWorld!');}</Code></Method><Counter><Count>1</Count></Counter></Class>

Yorick

[edit |edit source]
write, "Hello, world!";

Note: The semicolon is optional.

Zdzich

[edit |edit source]

Programming language with commands in Polish.Webpage

pisz Hello World!koniec

Graphical user interfaces (GUIs)

[edit |edit source]

ActionScript (Adobe Flash)

[edit |edit source]
this.createTextField("hello_txt",0,10,10,100,20);this.hello_txt.text="Hello, world!";

AppleScript

[edit |edit source]
display dialog"Hello, world!"buttons{"OK"}defaultbutton1

boo

[edit |edit source]
importSystem.DrawingimportSystem.Windows.Formsf=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.

C#

[edit |edit source]

In C# 10, using theMessageBox class, with top-level statements enabled (default), the code is only one line:

MessageBox.Show("Hello, world!");

Alternatively, one could write the dialog box from the scratch:

publicclassHelloWorldForm:Form{publicstaticvoidMain(){Application.EnableVisualStyles();Application.Run(newHelloWorldForm());}publicHelloWorldForm(){Labellabel=newLabel();label.Text="Hello, world!";label.Location=newPoint(40,30);this.Controls.Add(label);Buttonbutton=newButton();button.Text="OK";button.Location=newPoint(50,55);this.Controls.Add(button);button.Click+=newEventHandler(button_Click);}privatevoidbutton_Click(Objectsender,EventArgse){Application.Exit();}}

Clarion

[edit |edit source]

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    MAPHelloProcedure  PROCEDURE()    END    CODE    HelloProcedure()    RETURNHelloProcedure  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

Cocoa or GNUStep (In Objective C)

[edit |edit source]
#import <Cocoa/Cocoa.h>@interfacehello :NSObject{}@end@implementationhello-(void)awakeFromNib{NSBeep();// we don't need this but it's conventional to beep// when you show an alertNSRunAlertPanel(@"Message from your Computer",@"Hello, world!",@"Hi!",nil,nil);}@end

Curl

[edit |edit source]
{curl 3.0, 4.0 applet}{curl-file-attributes character-encoding = "utf-8"}Hello, world!

Delphi, Kylix

[edit |edit source]
programHello_World;usesQDialogs;beginShowMessage('Hello, world!');end.

or

programHello_World;usesQDialogs;beginMessageDlg('Hello, world!',mtInformation,[mbOk],0);end.

Erlang

[edit |edit source]
-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 enterhello_world:hello(). in the Erlang shell; another would be to run from a command line:

erl -noshell -run hello_world hello -run init stop

Euphoria

[edit |edit source]

MS-Windows only - basic.

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

MS-Windows only - using Win32Lib library

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

F#

[edit |edit source]

Using WindowsForms, at the F# interactive prompt:

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

FLTK2 (in C++)

[edit |edit source]
#include<fltk/Window.h>#include<fltk/Widget.h>#include<fltk/run.h>usingnamespacefltk;intmain(intargc,char**argv){Window*window=newWindow(300,180);window->begin();Widget*box=newWidget(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);returnrun();}

G (LabVIEW)

[edit |edit source]
PUBLIC SUB Main()  Message.Info("Hello, world!")END

Gtk# (in C#)

[edit |edit source]
usingGtk;usingGtkSharp;usingSystem;classHello{staticvoidMain(){Application.Init();Windowwindow=newWindow("");window.DeleteEvent+=cls_evn;Buttonclose=newButton("Hello, world!");close.Clicked+=newEventHandler(cls_evn);window.Add(close);window.ShowAll();Application.Run();}staticvoidcls_evn(objectobj,EventArgsargs){Application.Quit();}}

GTK+ 2.x (in Euphoria)

[edit |edit source]
include gtk2/wrapper.eInfo(NULL,"Hello","Hello, world!")

IOC/OCL (in IBM VisualAge for C++)

[edit |edit source]
#include<iframe.hpp>voidmain(){IFrameWindowframe("Hello, world!");frame.showModally()}

Java

[edit |edit source]

Swing

[edit |edit source]
importjavax.swing.*;classHelloWorld{publicstaticvoidmain(finalString[]args){JFrameframe=newJFrame();frame.add(newJLabel("Hello World",SwingConstants.CENTER));frame.setSize(200,100);frame.setLocationRelativeTo(null);frame.setVisible(true);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}}

JavaFX and FXML files

[edit |edit source]
packageexample;publicclassFXMLDocumentControllerextendsApplicationimplementsInitializable{@Overridepublicvoidstart(Stagestage)throwsException{Parentroot=FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));Scenescene=newScene(root);stage.setScene(scene);stage.show();}@FXMLprivateLabellabel;@Overridepublicvoidinitialize(URLurl,ResourceBundlerb){label.setText("Hello World!");}publicstaticvoidmain(String[]args){launch(args);}}
<?xml version="1.0" encoding="UTF-8"?><?import java.lang.*?><?import java.util.*?><?import javafx.scene.*?><?import javafx.scene.control.*?><?import javafx.scene.layout.*?><AnchorPaneid="AnchorPane"prefHeight="200"prefWidth="320"xmlns:fx="http://javafx.com/fxml/1"fx:controller="example.FXMLDocumentController"><children><LabellayoutX="126"layoutY="80"minHeight="16"minWidth="69"fx:id="label"/></children></AnchorPane>

GTK (java-gnome)

[edit |edit source]
importorg.gnome.gdk.*;classGdkSimpleextendsWindow{publicGdkSimple(){setTitle("Example");connect((DeleteEvent)(source,event)->{Gtk.mainQuit();returnfalse;});add(newLabel("Hello World"));setDefaultSize(250,150);setPosition(WindowPosition.CENTER);show();}publicstaticvoidmain(String[]args){Gtk.init(args);newGdkSimple();Gtk.main();}}

K

[edit |edit source]

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

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

Microsoft Foundation Classes (in C++)

[edit |edit source]
#include<afx.h>#include<afxwin.h>classCHelloWin:publicCWnd{protected:DECLARE_MESSAGE_MAP()afx_msgvoidOnPaint(void){CPaintDCdc(this);dc.TextOut(15,3,TEXT("Hello, world!"),13);}};BEGIN_MESSAGE_MAP(CHelloWin,CWnd)ON_WM_PAINT()END_MESSAGE_MAP()classCHelloApp:publicCWinApp{virtualBOOLInitInstance();};CHelloApptheApp;LPCTSTRwndClass;BOOLCHelloApp::InitInstance(){CWinApp::InitInstance();CHelloWin*hello=newCHelloWin();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();returnTRUE;}

Adobe Flex MXML

[edit |edit source]
<?xml version="1.0" encoding="utf-8"?><mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml"><mx:Labeltext="Hello, world!"/></mx:Application>

NSIS

[edit |edit source]

This creates a message box saying "Hello, world!".

OutFile"HelloWorld.exe"Name"Hello, world!"Caption"Hello, world!"SectionHello,world!SectionEndFunction.onInitMessageBoxMB_OK"Hello, world!"QuitFunctionEnd

OCaml

[edit |edit source]

Uses lablgtk

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

OPL

[edit |edit source]

(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   DIALOGENDP

Pure Data

[edit |edit source]

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;

Python

[edit |edit source]

Tkinter

[edit |edit source]
fromTkinterimportTk,Labelroot=Tk()Label(root,text="Hello, world!").pack()root.mainloop()

Using PyQt:

importsysfromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*app=QApplication(sys.argv)label=QLabel("Hello, World!")label.show()sys.exit(app.exec_())

PyGTK

[edit |edit source]
fromgtkimport*label=Label("Hello, world!")label.show()window=Window()window.add(label)window.show()main()

Pygame

[edit |edit source]
importpygameimportsyspygame.init()screen=pygame.display.set_mode((512,256),0,32)f=pygame.font.SysFont(None,32)t=f.render("Hello, world!",True,(255,255,255))tR=t.get_rect()screen.blit(t,tR)whileTrue:foreventinpygame.event.get():ifevent.type==pygame.QUIT:pygame.quit()sys.exit()pygame.display.update()

Kivy

[edit |edit source]

Kivy multi-platform framework

importkivyfromkivy.appimportAppfromkivy.uix.labelimportLabelclassMyApp(App):defbuild(self):returnLabel(text='Hello world')MyApp().run()

Qt toolkit (in C++)

[edit |edit source]
#include<QApplication>#include<QMessageBox>intmain(intargc,char*argv[]){QApplicationapp(argc,argv);QMessageBox::information(0,"Qt4","Hello World!");}

or

#include<qapplication.h>#include<qpushbutton.h>#include<qwidget.h>#include<iostream>classHelloWorld:publicQWidget{Q_OBJECTpublic:HelloWorld();virtual~HelloWorld();publicslots:voidhandleButtonClicked();QPushButton*mPushButton;};HelloWorld::HelloWorld():QWidget(),mPushButton(newQPushButton("Hello, world!",this)){connect(mPushButton,SIGNAL(clicked()),this,SLOT(handleButtonClicked()));}HelloWorld::~HelloWorld(){}voidHelloWorld::handleButtonClicked(){std::cout<<"Hello, world!"<<std::endl;}intmain(intargc,char*argv[]){QApplicationapp(argc,argv);HelloWorldhelloWorld;app.setMainWidget(&helloWorld);helloWorld.show();returnapp.exec();}

or

#include<QApplication>#include<QPushButton>#include<QVBoxLayout>intmain(intargc,char*argv[]){QApplicationapp(argc,argv);QWidget*window=newQWidget;QVBoxLayout*layout=newQVBoxLayout(window);QPushButton*hello=newQPushButton("Hello, world!",window);//connect the button to quittinghello->connect(hello,SIGNAL(clicked()),&app,SLOT(quit()));layout->addWidget(hello);layout->setMargin(10);layout->setSpacing(10);window->show();returnapp.exec();}

Rebol

[edit |edit source]
viewlayout [text"Hello, world!"]

Red

[edit |edit source]
view [text"Hello, world!"]

Robotic (MegaZeux)

[edit |edit source]
* "Hello, world!"end

RPL

[edit |edit source]

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

<< "Hello, world!" MSGBOX >>

RTML

[edit |edit source]
Hello ()TEXT "Hello, world!"

Ruby with WxWidgets

[edit |edit source]
require'wxruby'classHelloWorldApp<Wx::Appdefon_initourFrame=Wx::Frame.new(nil,-1,"Hello, world!").showourDialogBox=Wx::MessageDialog.new(ourFrame,"Hello, world!","Information:",\Wx::OK|Wx::ICON_INFORMATION).show_modalendendHelloWorldApp.new.main_loop

Ruby with GTK+

[edit |edit source]
require'gtk2'Gtk.initwindow=Gtk::Window.newwindow.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_allGtk.main

Ruby with Tk

[edit |edit source]
require'tk'window=TkRoot.new{title'Hello, world!'}button=TkButton.new(window){text'Hello, world!'commandproc{exit}pack}Tk.mainloop

Smalltalk

[edit |edit source]

Evaluate in a workspace:

Dialogconfirm:'Hello, world!'

Using the Morphic GUI toolkit of Squeak Smalltalk:

('Hello, world!'asMorphopenInWindow)submorphssecondcolor:Colorblack

Using wxSqueak:

WxmessageBox:'Hello, world!'

SWT with Java

[edit |edit source]
importorg.eclipse.swt.SWT;importorg.eclipse.swt.layout.RowLayout;importorg.eclipse.swt.widgets.Display;importorg.eclipse.swt.widgets.Shell;importorg.eclipse.swt.widgets.Label;publicclassSWTHello{publicstaticvoidmain(String[]args){Displaydisplay=newDisplay();finalShellshell=newShell(display);RowLayoutlayout=newRowLayout();layout.justify=true;layout.pack=true;shell.setLayout(layout);shell.setText("Hello, world!");Labellabel=newLabel(shell,SWT.CENTER);label.setText("Hello, world!");shell.pack();shell.open();while(!shell.isDisposed()){if(!display.readAndDispatch())display.sleep();}display.dispose();}}

Tk

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

and the same in one line

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

Tcl with Tk

[edit |edit source]
packagerequireTktk_messageBox-message"Hello, world!"

or

packagerequireTkpack[button.b-text"Hello, world!"-commandexit]

Ubercode

[edit |edit source]
 Ubercode 1 class Hello public function main() code   call Msgbox("Hello", "Hello, world!") end function end class

Uniface

[edit |edit source]
 message "Hello, world!"

Virtools

[edit |edit source]
voidmain(){Strings="Hello World.";bc.OutputToConsole(s);}

VBA

[edit |edit source]
SubMain()MsgBox"Hello, world!"EndSub

Visual Basic .NET 2003/2005

[edit |edit source]
PrivateSubForm_Load(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesMyBase.LoadMessageBox.Show("Hello, world!")Me.Close()EndSub

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:

PublicModuleMyApplicationSubMain()MessageBox.Show("Hello, world!")EndSubEndClass

or using a class;

PublicClassMyApplicationSharedSubMain()MessageBox.Show("Hello, world!")EndSubEndClass

Visual Prolog (note box)

[edit |edit source]
#include@"pfc\vpi\vpi.ph"goalvpiCommonDialogs::note("Hello, world!").

Windows API (in C)

[edit |edit source]

This uses the Windows API to create a full window containing the text.

/* Name: Win32 example Copyright: GLP Author: Ryon S. Hunter 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"BOOLInitInstance(HINSTANCE,int);ATOMMyRegisterClass(HINSTANCE);LRESULTCALLBACKWinProc(HWND,UINT,WPARAM,LPARAM);LRESULTCALLBACKWinProc(HWNDhWnd,UINTmessage,WPARAMwParam,LPARAMlParam){PAINTSTRUCTps;COLORREFc=RGB(0,0,0);HDChdc;RECTrt;switch(message){caseWM_DESTROY:// Exit the window? OkPostQuitMessage(0);break;caseWM_PAINT:GetClientRect(hWnd,&rt);hdc=BeginPaint(hWnd,&ps);DrawText(hdc,"Hello world!",sizeof("Hello world!"),&rt,DT_CENTER);EndPaint(hWnd,&ps);break;}returnDefWindowProc(hWnd,message,wParam,lParam);}ATOMMyRegisterClass(HINSTANCEhInstance){WNDCLASSEXwc;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;returnRegisterClassEx(&wc);}BOOLInitInstance(HINSTANCEhInstance,intnCmdShow){HWNDhWnd;hWnd=CreateWindow(// Create a win32 windowAPPTITLE,APPTITLE,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,500,400,NULL,NULL,hInstance,NULL);if(!hWnd)returnFALSE;ShowWindow(hWnd,nCmdShow);UpdateWindow(hWnd);returnTRUE;}intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,LPSTRlpCmdLine,intnCmdShow){MSGmsg;MyRegisterClass(hInstance);if(!InitInstance(hInstance,nCmdShow))return1;while(GetMessage(&msg,NULL,0,0)){TranslateMessage(&msg);DispatchMessage(&msg);}returnmsg.wParam;}

Xojo

[edit |edit source]

In the Open event handler of the default window:

MsgBox("Hello world!")

XUL

[edit |edit source]
<?xml version="1.0"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?><windowid="yourwindow"xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><labelvalue="Hello, World!"/></window>

Maple

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

Document formats

[edit |edit source]

ASCII

[edit |edit source]

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 0111011108-0E: 01101111 01110010 01101100 01100100 00100001 00001101 00001010

Page description languages

[edit |edit source]

XHTML 1.1

[edit |edit source]

(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"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>Hello, world!</title></head><body><p>Hello, world!</p></body></html>

HTML

[edit |edit source]

Simple

[edit |edit source]
<html><body>    Hello, world!</body></html>

Informal

[edit |edit source]

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

Hello, world!

HTML 4.01 Strict (full)

[edit |edit source]
<!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 onThe global structure of an HTML document also features this example.

HTML 4.01 Strict (smallest)

[edit |edit source]

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!

HTML 5

[edit |edit source]
<!DOCTYPE html><html><head><title>Hello, World!</title></head><body><h1>Hello, world!</h1></body></html>

Markdown

[edit |edit source]
Hello, World!

MediaWiki/Wikitext

[edit |edit source]
Hello, World!

PDF

[edit |edit source]
%PDF-1.01 0 obj<</Type /Catalog/Pages 3 0 R/Outlines 2 0 R>>endobj2 0 obj<</Type /Outlines/Count 0>>endobj3 0 obj<</Type /Pages/Count 1/Kids [4 0 R]>>endobj4 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>>endobj5 0 obj<< /Length 44 >>streamBT/F1 24 TF100 100 Td (Hello, world!) TjETendstreamendobj6 0 obj[/PDF /Text]endobj7 0 obj<</Type /Font/Subtype /Type1/Name /F1/BaseFont /Helvetica/Encoding /MacRomanEncoding>>endobjxref0 80000000000 65535 f0000000009 00000 n0000000074 00000 n0000000120 00000 n0000000179 00000 n0000000322 00000 n0000000415 00000 n0000000445 00000 ntrailer<</Size 8/Root 1 0 R>>startxref553%%EOF

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

PostScript

[edit |edit source]
% Displays on console.(Hello, world!)=
%!% Displays as page output./Courierfindfont24scalefontsetfont100100moveto(Hello, world!)showshowpage

RTF

[edit |edit source]
{\rtf1\ansi\deff0{\fonttbl {\f0 Courier New;}}\f0\fs20 Hello, world!}

SVG

[edit |edit source]
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svgxmlns="http://www.w3.org/2000/svg"width="200"height="100"><textx="50"y="50">Hello,world!</text></svg>

TeX

[edit |edit source]
 Hello, world!\bye

LaTeX 2ε

[edit |edit source]
\documentclass{article}\begin{document}   Hello, world!\end{document}

ConTeXt

[edit |edit source]
\starttext    Hello, world!\stoptext

Media-based scripting languages

[edit |edit source]

AviSynth

[edit |edit source]
 BlankClip() Subtitle("Hello, world!")

(Creates a video with default properties)

Lingo (Macromedia Director scripting language)

[edit |edit source]
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

POV-Ray

[edit |edit source]
#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,0pigment{White}}

Esoteric programming languages

[edit |edit source]

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.

0815

[edit |edit source]
<:48:x<:65:=<:6C:$=$=$$~<:03:+$<:2c:~$~<:c:x-$<:77:~$~<:8:x-$~<:03:+$~<:06:x-$x<:0e:x-$=x<:43:x-$

Alef++

[edit |edit source]
usejava.lang.*;main{System->out->println['Hello,world!'];}

Arrow

[edit |edit source]
 ■→→■↓■←■←■↓■→→■  /* makes H */ →→■↓■↑↑↑■        /* makes I */

Befunge

[edit |edit source]
"!dlrow olleH">v:,^_@
vv"Hello, world!!"<>^>>:#v_@^.<
0"!dlrow olleH">,:#<_@

Binary lambda calculus

[edit |edit source]

As documented athttp://www.ioccc.org/2012/tromp/hint.html(any of the 16 ASCII characters from ' ' to '/' can be used at the start)

   !Hello, world

BlooP, FlooP

[edit |edit source]

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.

brainfuck

[edit |edit source]
++++++++++             initialize counter (cell #0) to 10[                       use loop to set the next four cells to 70/100/30/10>+++++++              add  7 to cell #1>++++++++++           add 10 to cell #2>+++                   add  3 to cell #3>+                     add  1 to cell #4<<<<-                  decrement counter (cell #0)]>++.                  print 'H'>+.                   print 'e'+++++++.              print 'l'.                       print 'l'+++.                   print 'o'>++.                  print ' '<<+++++++++++++++.  print 'W'>.                     print 'o'+++.                   print 'r'------.               print 'l'--------.             print 'd'>+.                   print '!'>.                     print '\n'

Chef

[edit |edit source]

Hello, world! Souffle by David Morgan-Mar.

Hello World Souffle.This recipe prints the immortal words "Hello world!", in a basically brute force way. It also makes a lot of food for one person.Ingredients.72 g haricot beans101 eggs108 g lard111 cups oil32 zucchinis119 ml water114 g red salmon100 g dijon mustard33 potatoesMethod.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.

Later Mike Worth wrotetastier and actually functional recipe.

Hello World Cake with Chocolate sauce.This prints hello world, while being tastier than Hello World Souffle. The mainchef makes a " world!" cake, which he puts in the baking dish. When he gets thesous chef to make the "Hello" chocolate sauce, it gets put into the baking dishand then the whole thing is printed when he refrigerates the sauce. Whenactually cooking, I'm interpreting the chocolate sauce baking dish to beseparate from the cake one and Liquify to mean either melt or blend depending oncontext.Ingredients.33 g chocolate chips100 g butter54 ml double cream2 pinches baking powder114 g sugar111 ml beaten eggs119 g flour32 g cocoa powder0 g cake mixtureCooking time: 25 minutes.Pre-heat oven to 180 degrees Celsius.Method.Put chocolate chips into the mixing bowl.Put butter into the mixing bowl.Put sugar into the mixing bowl.Put beaten eggs into the mixing bowl.Put flour into the mixing bowl.Put baking powder into the mixing bowl.Put cocoa  powder into the mixing bowl.Stir the mixing bowl for 1 minute.Combine double cream into the mixing bowl.Stir the mixing bowl for 4 minutes.Liquify the contents of the mixing bowl.Pour contents of the mixing bowl into the baking dish.bake the cake mixture.Wait until baked.Serve with chocolate sauce.chocolate sauce.Ingredients.111 g sugar108 ml hot water108 ml heated double cream101 g dark chocolate72 g milk chocolateMethod.Clean the mixing bowl.Put sugar into the mixing bowl.Put hot water into the mixing bowl.Put heated double cream into the mixing bowl.dissolve the sugar.agitate the sugar until dissolved.Liquify the dark chocolate.Put dark chocolate into the mixing bowl.Liquify the milk chocolate.Put milk chocolate into the mixing bowl.Liquify contents of the mixing bowl.Pour contents of the mixing bowl into the baking dish.Refrigerate for 1 hour.

False

[edit |edit source]
"Hello, World!"

The newline before the terminating quote mark is necessary.

HQ9+

[edit |edit source]
H

INTERCAL programming language

[edit |edit source]
PLEASEDO,1<-#13DO,1SUB#1<-#238DO,1SUB#2<-#112DO,1SUB#3<-#112DO,1SUB#4<-#0DO,1SUB#5<-#64DO,1SUB#6<-#238DO,1SUB#7<-#26DO,1SUB#8<-#248DO,1SUB#9<-#168DO,1SUB#10<-#24DO,1SUB#11<-#16DO,1SUB#12<-#158DO,1SUB#13<-#52PLEASEREADOUT,1PLEASEGIVEUP

LOLCODE

[edit |edit source]
HAI;    CAN HAS STDIO?;    VISIBLE "Hello, World!";KTHXBYE;

LOLGraphics

[edit |edit source]
HAI 3.4 0 100IM IN UR CODE EXECUTIN UR KOMANDZPLZ PRINT TEXT HELLO WORLD! IM OUTTA UR CODE

Malbolge programming language

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

P programming language

[edit |edit source]
"Hello, world!\n"

Perl

[edit |edit source]

Not really an esoteric language, but this code usesobfuscation:

qq choplcandprintchrorducq chopucandprintchrordq nesinandprintchrordqw qleq andprintchrordq elseandprintchrordq popandprintchroctoctorducqw qbindq andprintchrordq qeqandprintchrordqw qwarnq andprintchrordq popandprintchrordq qr q andprintchrordq elseandprintchrordqw qdoq andprintchrhexlengthq qsemctlsetpgrpchopq


Piet

[edit |edit source]

Piet programming language uses only colors.

Hello world in piet (see from 41:40 minute on "The Art of Code" on YouTube)

Rockstar

[edit |edit source]
Shout "Hello, world!"

Shakespeare

[edit |edit source]
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'sday. 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]

SNUSP

[edit |edit source]
   /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.>+.@/.#  \@@@@=>++++>+++++<<@+++++#       #---@@/!=========/!==/

Spoon (programming language)

[edit |edit source]
1111110010001011111111111101100000110100010100101111111111001000101111111111011000001101 0100101011111110010100010101110010100101111001000101111111111101100000110100010100111110 0100010000000000000011000001101000101001101101101101111100100010111110110000011010001010 0100100010101110010100000000000000000000010100000000000000000000000000010100100101001010

Super NAND Time!!

[edit |edit source]
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 4431 ((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

Taxi programming language

[edit |edit source]
"Hello, World!" is waiting at the Writer's Depot.Go to Writer's Depot: west 1st left, 2nd right, 1st left, 2nd left.Pickup a passenger going to the Post Office.Go to the Post Office: north 1st right, 2nd right, 1st left.Go to the Taxi Garage: north 1st right, 1st left, 1st right.

T programming language

[edit |edit source]
%begin @jump $main%main.0 @echo %msg%main.1 @end%main.count 2%msg Hello, world!

This=That

[edit |edit source]
x=Hello,world!x=print

Unlambda programming language

[edit |edit source]
  `r```````````.H.e.l.l.o. .w.o.r.l.di

Var'aq programming language

[edit |edit source]

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

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

Whitespace

[edit |edit source]

Note that whitespace has been highlighted (Space,Tab)

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

XS programming language

[edit |edit source]
<print>Hello, world!</print>

Ya programming language

[edit |edit source]
@HelloWorld.Ya;using<stdio.h>;$int($char[][]args)mainprintf("Hello, %s!\n",args.Length>1?args[1]:"World");return0;

DUNNBOL1

[edit |edit source]

A code language that draws in binary on a braille plotter.

BGN GRPLOT BINDRAWPLOT000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111001110011111110011100000000111000000000011111000000000010000010000111110000011111000001000000000111111100000001000010000100001000100000000001000000000010000010000000001000001000100000100010000010000100000000010000001000000100001000010000000010000000000100000000001000001000000000100000100010000010001000001000010000000001000000100000011111100001111000001000000000010000000000100000100000000010010010001000001000111111100001000000000100000010000001000010000100000000100000000001000000000010000010000000001011101000100000100010000001000100000000010000001000000100001000010000100010000000000100000000001000001000000000110001100010000010001000000010010000000001000000100000111001110011111110011111111000111111110000011111000000000010000010000111110000100000001001111111000111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ENDDRAWEND

SM

[edit |edit source]

The OO language looks like C.

useSystem.Windows.Forms;classHelloWorldextendsSystem.Windows.Forms{protected:Stringhw;constructHelloWorld(){this.hw='Hello, world!';}publicvoidfunctionshow(){MessageBox.show(this.hw,'');}}

Skript+

[edit |edit source]

Copy this and paste in ChatGPT, on a new chat:

Output: Hello, world!

A longer version, which still prints "Hello, world!":

CreateBuf: $Hello$$Hello$: {[H][e][l][l][o][,][32] @ The ASCII value for space[w][o][r][l][d][!]}OpenBuf: $Hello$JoinAllChars: $Hello$ => $Hello2$Output: $Hello2$CloseBuf: $Hello$

Note: The first method is tested and it's working. I don't know about the second one!

Retrieved from "https://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world&oldid=4497040"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp