以下是用不同程式語言寫成的 Hello World 程式的列表： 列印到終端 ActionScript trace Hello world The Hello World Collection helloworldcollectionde 20141212 Ada with TEXT_IO procedure HELLO is begin TEXT_IOPUT_LINE Hello world end HELLO zhhans 彙編；zhhant 組合； 語言 x86 CPU，GNULinux，NASM section data msg db Hello world0xA len equ msg section text global _start _start mov edxlen mov ecxmsg mov ebx1 mov eax4 int 0x80 mov ebx0 mov eax1 int 0x80 x86 ATT、gas data msg string Hello worldn len msg text global _start _start movl len edx movl msg ecx movl 1 ebx movl 4 eax int 0x80 movl 0 ebx movl 1 eax int 0x80 x86 CPU、Windows、MASM32 386 model flatstdcall option casemapnone include windowsinc include user32inc includelib user32lib include kernel32inc includelib kernel32lib data szCaption db A MessageBox 0 szText db Hello world 0 code start invoke MessageBox NULL addr szText addr szCaption MB_OK invoke ExitProcess NULL end start 8086 作業系統（NASM） BITS 16 org 0x7c00 mov axcs mov dsax mov esax call DispStr jmp End Hear DispStr mov ax BootMessage mov bp ax mov cx 16How long is the String mov ax 0x1301 mov bx 0x000c mov dl 0 int 0x10 ret BootMessage db Hello world times 510 db 0x0 dw 0xaa55 Bootable Mark AutoIt MsgBox 1Hello world AWK BEGIN print Hello world Bash 或其他 Unix Shell echo Hello world 或者： printf Hello worldn BASIC 傳統版 BASIC（例如 GWBASIC）： 10 PRINT Hello world 20 END 或： 10 PRINT Hello world 或在提示符輸入： Hello world 現代版 BASIC（例如 Quick BASIC）： Print Hello world 以下的語句，在 Quick BASIC 中同樣有效： Hello world BCPL GET LIBHDR LET START BE WRITES Hello worldN Brainfuck Blitz Basic Print Hello world WaitKey BOO print Hello world C include stdioh int main void printf Hello worldn return 0 或者： include stdioh int main void puts Hello world return 0 CoffeeScript consolelog Hello world 或者： alert Hello world C include iostream int main stdcout Hello world stdendl return 0 或者： include iostream using namespace std int main cout Hello world endl return 0 CCLI int main SystemControlWriteLine Hello world C C Sharp using System class HelloWorldApp static void Main string args ConsoleWriteLine Hello world 或者（僅用於 Microsoft Windows） class HelloWorldApp DllImport user32dll static extern MessageBox string title string message public static void Main MessageBox null Hello world 或者（使用附加的 Windows Forms） using SystemWindowsForms class HelloWorldApp public static void Main MessageBoxShow Hello world COBOL IDENTIFICATION DIVISION PROGRAMID HELLOWORLD ENVIRONMENT DIVISION DATA DIVISION PROCEDURE DIVISION DISPLAY Hello world STOP RUN Common Lisp 直接輸出 Hello world 或者 format t Hello world DOS 批處理 echo Hello world 對於 MSDOS 30 或更低版本： echo off cls echo Hello world Eiffel class HELLO_WORLD creation make feature make is local ioBASIC_IO do io ioput_string N Hello world end make end class HELLO_WORLD Erlang module hello export hello_world0 hello_world iofwrite Hello Worldn Flowgorithm Forth Hello world CR Fortran WRITE Hello world STOP END Go package main import fmt func main fmtPrintln Hello world INTERCAL PLEASE DO 1 13 DO 1 SUB 1 238 DO 1 SUB 2 112 DO 1 SUB 3 112 DO 1 SUB 4 0 DO 1 SUB 5 64 DO 1 SUB 6 238 DO 1 SUB 7 26 DO 1 SUB 8 248 DO 1 SUB 9 168 DO 1 SUB 10 24 DO 1 SUB 11 16 DO 1 SUB 12 158 DO 1 SUB 13 52 PLEASE READ OUT 1 PLEASE GIVE UP Java public class Hello public static void main String args Systemoutprint Hello world 或者： class HelloWorld public static void main String args Systemoutprint Hello world JavaScript 該程式碼適用於瀏覽器控制檯以及 Nodejs 等伺服器端執行環境。 consolelog Hello World Julia println Hello world Lisp 直接輸出 hello world 或者 format t hello world Lua print Hello world Malbolge 96ZY327Uv4QsqpMnIjE e Abw_ Kw o44Uqp0QxNvLH cDD2WVgYdts76qKJImZkj Matlab disp hello world Mathematica Hello Print Hello World Hello Metapost beginfig 1 draw 00010 draw 0555 draw 50510 draw 120707101210 draw 12575 draw 1410140190 draw 2110210260 draw 285305033530510cycle draw 38103925040510417504310 draw 455475050547510cycle draw 5205210 draw 52105745265 draw 525570 draw 6110610660 draw 6810680735cycle endfig end MIXAL TERM EQU 19 the MIX console device number ORIG 1000 start address START OUT MSG TERM output data at address MSG HLT halt execution MSG ALF MIXAL ALF HELL ALF O WOR ALF LD END START end of the program Nuva 直接輸出 Hello world 或者 不帶換行 Hello world 或者 帶換行 Hello world ObjectiveC import FoundationFoundationh int main int argc const char argv autoreleasepool NSLog Hello World return 0 OCaml let main print_endline Hello world Pascal program Hello此行可以省略 begin writeln Hello world end Perl usrbinenv perl print Hello worldn Perl 510（含）以後版本 usrbinenv perl use 5010 say Hello world Pike usrlocalbinpike int main write Hello worldn return 0 PLI Test procedure options main declare My_String char 20 varying initialize Hello world put skip list My_String end Test Prolog goal write helloworld Python 適用於 Python 2： usrbinenv python print Hello world 適用於 Python 26 27 3： usrbinenv python print Hello world 用彩蛋輸出 Hello World： usrbinenv python import __hello__ REXX say Hello world Ruby usrbinruby puts Hello world Rust fn main printlnHello world Scheme display Hello world newline Scratch sed （需要至少一行輸入） sed ne 1sHello worldp Seed7 include seed7_05s7i const proc main is func begin writeln Hello world end func Smalltalk Transcript show Hello world Small Basic TextWindowWriteLine Hello world SNOBOL OUTPUT Hello world END SQL 第一種 create table MESSAGE TEXT char 15 insert into MESSAGE TEXT values Hello world select TEXT from MESSAGE drop table MESSAGE 第二種 select hello world 第三種 print helloworld Swift 適用於 Swift 1x： println Hello World 適用於 Swift 2x 3： print Hello World Tcl usrlocalbintcl puts Hello world TScript Hello world Turing put Hello world Unix shell 指令碼 程式中的 binsh 可改為您使用的 shell binsh echo Hello world bc usrbinbc q print Hello World quit dc usrbinenv dc Hello World p 圖形使用者介面 AppleScript display dialog Hello world 或者： display alert Hello world Delphi program HelloWorld uses Dialogs begin ShowMessage Hello World end Nuva SystemUiShowMessage Nuva Hello world OK Visual Basic Sub Main MsgBox Hello world End Sub Visual FoxPro Hello world X11 用一個程式 xmessage Hello world 使用 Qt include QApplication include QLabel int main int argc char argv QApplication app argc argv QLabel label Hello world labelshow return appexec C 和 GTK include gtkgtkh int main int argc char args GtkWidget win label gtk_init argc args label gtk_label_new Hello world win gtk_window_new GTK_WINDOW_TOPLEVEL gtk_container_add GTK_CONTAINER win label gtk_widget_show_all gtk_main return 0 用 C 和 gtkmm 2 include iostream include gtkmmmainh include gtkmmbuttonh include gtkmmwindowh using namespace std class HelloWorld public GtkWindow public HelloWorld virtual HelloWorld protected GtkButton m_button virtual void on_button_clicked HelloWorldHelloWorld m_button Hello world set_border_width 10 m_buttonsignal_clicked connect SigCslot this HelloWorldon_button_clicked add m_button m_buttonshow HelloWorldHelloWorld void HelloWorldon_button_clicked cout Hello world endl int main（int argc char argv ） GtkMain kit argc argv HelloWorld helloworld GtkMainrun helloworld Java import javaawt import javaawtevent public class HelloFrame extends Frame HelloFrame String title super title public void paint Graphics g superpaint g javaawtInsets ins thisgetInsets gdrawString Hello World insleft 25 instop 25 public static void main String args HelloFrame fr new HelloFrame Hello fraddWindowListener new WindowAdapter public void windowClosing WindowEvent e Systemexit 0 frsetResizable true frsetSize 500 100 frsetVisible true Java Applet Java Applet 用於 HTML 檔案。 HTML 程式碼： html head titleHello Worldtitle head body HelloWorld Program says applet codeHelloWorldclass width600 height100 applet body html Java 程式碼： import javaapplet import javaawt public class HelloWorld extends Applet public void paint Graphics g gdrawString Hello world 100 50 JavaScript JavaScript 是一種指令碼語言。最廣泛用於 HTML 檔案中，也可以用在其它宿主環境下，比如 Microsoft Windows 指令碼宿主（WSH）和一些 web 服務環境。 用於 HTML 中： 彈出對話方塊 alert Hello World 在頁面上顯示 documentwrite Hello World 用於 WSH 中： WScriptEcho Hello World 作為伺服器端（Nodejs）：啟動後，需要在瀏覽器中訪問 http1270018000 檢視。 const http require http httpcreateServer request response responsewriteHead 200 ContentType textplain responseend Hello World listen 8000 consolelog Server running at http1270018000 PostScript PostScript 是一種專門用來建立影像的語言，常用於印表機。 fontCourier findfont 24 scalefont font setfont 100 100 moveto Hello World show showpage SPARQL SELECT h WHERE VALUES h Hello World leachim6helloworld GitHub 20210620 XAML Page xmlnshttpschemasmicrosoftcomwinfx2006xamlpresentation xmlnsxhttpschemasmicrosoftcomwinfx2006xaml xClassXAMLSamplePage1 Button ClickHelloWorld NameButton1Click HereButton Page 接著使用 C 建置 using System using SystemWindows using SystemWindowsControls namespace XAMLSample public partial class Page1 Page void HelloWorld object sender RoutedEventArgs e MessageBoxShow Hello world 易語言 版本 2 程式集 視窗程式集 1 子程式 __啟動視窗_建立完畢 資訊框 Hello World 0 伺服器端 以下為 Web 服務端示例程式，程式啟動後，需要用瀏覽器訪問特定地址來檢視結果。 ASP ResponseWrite Hello world 或者簡單地寫成： Hello world HTML 直接輸出 Hello World 或者 html head title Hello World title head body Hello World body html Go package main import fmt nethttp func helloHandler w httpResponseWriter r httpRequest fmtFprintf w hello world func main httpHandleFunc helloHandler httpListenAndServe 00008000 nil JSP outprint Hello world 或者簡單地寫成： Hello world JavaScript 以下為 Nodejs 環境： const http require http httpcreateServer request response responsewriteHead 200 ContentType textplain responseend Hello World listen 8000 consolelog Server running at http1270018000 PHP 以下程式碼既可以作為伺服器端執行，顯示在使用者瀏覽器上，也可以在終端中直接執行，輸出到終端中： php echo Hello world 或者 print Hello world 或者 Hello World 參見 Hello World 參考文獻 外部連結 GitHub 上的 Hello World 程式樣例集 Category 計算機程式設計 Category 帶有 C 程式碼示例的條目