Hello world
|
|
Cet article devrait être scindé en plusieurs articles distincts.
Pour plus d’informations, se reporter en page de discussion.
|
hello world (traduit littéralement en français par « bonjour le monde ») sont les mots traditionnellement écrits par un programme informatique simple dont le but est de faire la démonstration rapide d'un langage de programmation (par exemple à but pédagogique) ou le test d'un compilateur.
Certains des programmes imprimant ces mots sont étonnamment complexes, particulièrement dans un contexte d'interface graphique. D'autres sont très simples, particulièrement ceux qui utilisent un interpréteur de ligne de commande pour afficher le résultat. Dans plusieurs systèmes embarqués, le texte peut être envoyé sur une ou deux lignes d'un afficheur LCD (ou dans d'autres systèmes, une simple DEL peut se substituer à un hello world).
[modifier] Histoire
Alors que les petits programmes de test existaient depuis le début de la programmation, la tradition d'utiliser hello world comme message de test a été initiée par le livre The C Programming Language de Brian Kernighan et Dennis Ritchie. Le premier exemple de ce livre affiche hello, world (sans majuscule ni point final, mais avec une virgule et un retour à la ligne final). Le premier hello world dont Ritchie et Kernighan se souviennent provient d'un manuel d'apprentissage du langage B écrit par Kernighan[1].
Au XXIe siècle, les programmes affichent plus souvent Hello world! comme une phrase, avec majuscule et point d'exclamation final.
[modifier] Le programme Hello world ! suivant les langages
[modifier] 4e Dimension
ALERTE("Hello World !")
[modifier] ABC
WRITE "Hello world!"
[modifier] ActionScript 3.0
[modifier] Dans la console
trace("Hello world!");
[modifier] Dans un champ de texte
import flash.text.TextField; var champ:TextField = new TextField(); champ.text = "Hello World!"; this.addChild(champ);
[modifier] En Flex dans une fenêtre alerte
Alert.show("Hello world !");
[modifier] Ada
with Ada.Text_IO; use Ada.Text_IO; procedure Bonjour is begin -- Bonjour Put("Hello world!"); end Bonjour;
[modifier] Alma
Hello world!
[modifier] AmigaE
PROC main()
WriteF('Hello world!')
ENDPROC
[modifier] APL
'Hello world!'
[modifier] AppleScript
display dialog "Hello world!"
[modifier] ASP et ASP.NET
<% Response.Write("Hello World") %>
[modifier] AspectJ
Main.java :
public class Main { public static void main(String[] args){ } }
HelloWorld.aj :
public aspect HelloWorld { pointcut mainCall() : call(public static void *.main(String[] args)); before() : mainCall() { System.out.println( "Hello world!" ); } }
[modifier] Assembleur de Bytecode Java
Ce code fonctionne avec les assembleurs Jasmin et Oolong.
.class public Hello .super java/lang/Object ; spécification du constructeur par défaut .method public <init>(); ; pousse la référence à l'objet courant sur la pile aload_0 ; appel statiquement lié aux constructeurs de la classe de base invokespecial java/lang/Object/<init>()V return .end method .method public static main([java/lang/String;)V .limit stack 2 ; pousse la réf. à l'objet statique out de la classe System sur la pile getstatic java/lang/System/out Ljava/io/PrintStream ; pousse la chaîne de caractère sur la pile ldc "Hello world!" ; appel polymorphe invokevirtual java/io/PrintStream/println(Ljava.lang.String;)V return .end method
[modifier] Assembleur x86 sous DOS
cseg segment assume cs:cseg, ds:cseg org 100h main proc jmp debut mess db 'Hello world!$' debut: mov dx, offset mess mov ah, 9 int 21h ret main endp cseg ends end main
[modifier] Assembleur x86, écrit pour l'assembleur TASM sous DOS
.model small .stack 100h .data bonjour db "Hello world!$" .code main proc mov AX,@data mov DS, AX mov DX, offset bonjour mov AX,0900h int 21h mov AX,4C00h int 21h main endp end main
[modifier] Assembleur x86, sous Linux, écrit pour l'assembleur NASM
section .data helloMsg: db 'Hello world!',10 helloSize: equ $-helloMsg section .text global _start _start: mov eax,4 ; Appel système "write" (sys_write) mov ebx,1 ; File descriptor, 1 pour STDOUT (sortie standard) mov ecx, helloMsg ; Adresse de la chaîne a afficher mov edx, helloSize ; Taille de la chaîne int 80h ; Execution de l'appel système ; Sortie du programme mov eax,1 ; Appel système "exit" mov ebx,0 ; Code de retour int 80h
[modifier] Assembleur x86 écrit pour l'assembleur FASM
org 100h mov dx, message mov ah, 09h int 21h ; Les quatre lignes suivantes servent à attendre qu'une touche soit frappée ; avant de quitter le programme normalement. ; Elles peuvent donc être exclues du programme, ; à ceci près que la visualisation du résultat sera impossible, ; la fenêtre de console se refermant trop vite. xor ah, ah int 16h mov ax, 4c00h int 21h message db "Hello world!$"
[modifier] Assembleur x86 écrit pour l'assembleur MASM
.386 .MODEL flat, stdcall OPTION CASEMAP: none Include kernel32.inc Include masm32.inc Includelib kernel32.lib Includelib masm32.lib .data HelloWorld db "Hello World!" , 0 .data? WaitBufer db 10 dup(?) .code Start : invoke StdOut, addr HelloWorld invoke StdIn, addr WaitBufer, 1 invoke ExitProcess, 0 End Start
[modifier] AutoIt
MsgBox(0, "Hello World!", "Hello World!")
[modifier] Awk
#!/usr/bin/awk -f BEGIN { print "Hello world!" }
[modifier] BASIC
10 PRINT "Hello world!" 20 END 'À noter que le END n est pas nécessaire
Les étiquettes (numéros devant les lignes) ne sont plus nécessaires dans les versions modernes (BBC BASIC for Windows, Quick Basic, Turbo Basic, QBasic, Visual Basic...). Elles ne sont plus utilisées que pour les instructions de contrôle de flux (les boucles et les sauts, notamment le GOTO et le GOSUB).
[modifier] Bash
#!/bin/bash echo Hello world
[modifier] BCPL
GET "LIBHDR"
LET START () BE
$(
WRITES ("Hello world!*N")
$)
[modifier] Befunge
<q_,#! #:<"Hello world!"a
[modifier] Brainfuck
préparation ++++++++++[>+++++++>++++++++++>+++>+<<<<-] écrit "Hello " >++. >+. +++++++. . +++. >++. écrit "World!" et passe à la ligne <<+++++++++++++++. >. +++. ------. --------. >+. >.
[modifier] C
#include <stdio.h> int main(void)// ou int argc, char *argv[] { printf("Hello world!\n"); return 0; }
[modifier] C (sous Microsoft Windows, API Win32)
#include <windows.h> int WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { MessageBox( NULL, TEXT ("Hello world!\n"), TEXT (""), MB_OK ); return 0; }
[modifier] C (sur Sony PSP)
#include <pspkernel.h> #include <pspdebug.h> PSP_MODULE_INFO("Hello World", 0, 1, 0); #define printf pspDebugScreenPrintf /* Exit callback */ int exit_callback(int arg1, int arg2, void *common) { sceKernelExitGame(); return 0; } /* Callback thread */ int CallbackThread(SceSize args, void *argp) { int cbid; cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); sceKernelSleepThreadCB(); return 0; } /* Sets up the callback thread and returns its thread id */ int SetupCallbacks(void) { int thid; thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) sceKernelStartThread(thid, 0, 0); return thid; } int main() { pspDebugScreenInit(); SetupCallbacks(); printf("Hello, World"); sceKernelSleepThread(); return 0; }
[modifier] C# (en Console)
using System; public class HelloWorld { public static void Main () { Console.WriteLine("Hello world!"); } }
[modifier] C# (Application Windows)
using System.Windows.Forms; public class HelloWorld { public static void Main() { MessageBox.Show("Hello world!"); } }
Voir windows Forms
[modifier] C++
#include <iostream> using namespace std; int main() { cout << "Hello world!" << endl; return 0; }
[modifier] Caml
print_endline "Hello world!";;
[modifier] Casio (calculatrices graphiques de la gamme « Graph xx »)
"Hello world!"
ou :
Locate 1,1,"Hello world!"
ou encore :
Text 1,1,"Hello world!"
[modifier] Ceylon
void hello() {
print("Hello World!");
}
[modifier] CIL
.method public static void Main() cil managed { .entrypoint .maxstack 8 ldstr "Hello world!." call void [mscorlib]System.Console::WriteLine(string) ret }
[modifier] Clean
module hello Start :: String Start = "Hello world!"
[modifier] CLIST
PROC 0 WRITE Hello world!
[modifier] COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "Hello world!".
STOP RUN.
Dans les versions modernes du langage, le programme se simplifie ainsi (la suppression du point sur l'avant-dernière ligne n'est pas une innovation) :
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY "Hello world!"
STOP RUN.
[modifier] Common Lisp
(princ "Hello world!")
[modifier] D
import std.stdio; void main () { writeln("Hello world!"); }
[modifier] Dark basic
print "Hello world"
[modifier] Delphi
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormActivate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormActivate(Sender: TObject); begin ShowMessage('Hello world'); end; end.
ou en console :
program hello_world; {$APPTYPE CONSOLE} uses SysUtils; begin writeln('Hello world!'); readln; end.
[modifier] Dialog/Xdialog
dialog --title 'Hello world!' --ok-label 'OK' --msgbox 'Hello world!' 0 0 Xdialog --title 'Hello world!' --ok-label 'OK' --msgbox 'Hello world!' 0 0 kdialog --title 'Hello world!' --msgbox 'Hello world!' 0 0
[modifier] DCL batch
$ write sys$output "Hello world!"
[modifier] ed et ex (Ed extended)
a Hello world! . p
ou comme ceci:
echo -e 'a\nHello world!\n.\np'|ed echo -e 'a\nHello world!\n.\np'|ex
[modifier] Eiffel
class HELLO_WORLD create execute feature {NONE} -- Initialization execute is -- Execute Hello World ! do io.put_string("Hello world!%N") end end
[modifier] Erlang
-module(hello). -export([hello_world/0]). hello_world() -> io:fwrite("Hello world!\n").
[modifier] EUPHORIA
puts(1, "Hello world!")
[modifier] Forte TOOL
begin TOOL HelloWorld; includes Framework; HAS PROPERTY IsLibrary = FALSE; forward Hello; -- START CLASS DEFINITIONS class Hello inherits from Framework.Object has public method Init; has property shared=(allow=off, override=on); transactional=(allow=off, override=on); monitored=(allow=off, override=on); distributed=(allow=off, override=on); end class; -- END CLASS DEFINITIONS -- START METHOD DEFINITIONS ------------------------------------------------------------ method Hello.Init begin super.Init(); task.Part.LogMgr.PutLine('Hello world!'); end method; -- END METHOD DEFINITIONS HAS PROPERTY CompatibilityLevel = 0; ProjectType = APPLICATION; Restricted = FALSE; MultiThreaded = TRUE; Internal = FALSE; LibraryName = 'hellowor'; StartingMethod = (class = Hello, method = Init); end HelloWorld;
[modifier] Forth
." Hello world!" CR
[modifier] Fortran (ANSI 77)
PROGRAM BONJOUR WRITE (*,*) 'Hello world!' END
[modifier] Frink
println["Hello world!"]
[modifier] Gambas
PUBLIC SUB Main()
Print "Hello world!"
END
[modifier] GML (Game Maker Language)
draw_text(x, y,"Hello world!");
ou, pour afficher un message:
show_message("Hello world!");
[modifier] Gnuplot
#! /usr/bin/gnuplot print "hello world"
[modifier] Go
fmt.Printf("Hello, world!");
[modifier] GOTO++
GOTOPRINTDUTEXTE() ; «Hello world!»
[modifier] Grails
class HelloWorldController {
def index = {render "Hello, world!" }
}
[modifier] Graphviz
echo "digraph G {Hello->World}" | dot -Tpng >hello.png
[modifier] Groovy
print "hello world"
[modifier] Haskell
module HelloWorld (main) where main = putStrLn "Hello world!"
[modifier] haXe
class Test { static function main() { trace("Hello World !"); } }
[modifier] Heron
program HelloWorld;
functions {
_main() {
String("Hello world!") |> GetStdOut();
}
}
end
[modifier] HP-41 et HP-42S
(calculatrice Hewlett-Packard alphanumérique)
01 LBLTHELLO 02 THELLO, WORLD 03 PROMPT
[modifier] HP-40 G
(calculatrice Hewlett-Packard)
DISP 1;"HELLO WORLD !": FREEZE:
[modifier] HTML
<!DOCTYPE html> <html lang="fr"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Hello world !</title> </head> <body> Hello World ! </body> </html>
[modifier] HTML5
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8"> <title>Hello world !</title> </head> <body> Hello World ! </body> </html>
[modifier] XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> <title>Afficher «Hello world» en XHTML 1.0 Strict</title> </head> <body> <p>Hello world !</p> </body> </html>
[modifier] ICON
[modifier] Inform 7
"Hello World" by "Anonymous" Earth is a room. The description of Earth is "Hello World!" When play begins: say "Bonjour tout le monde !"
[modifier] Iptscrae
ON ENTER {
"Hello " "world!" & SAY
}
[modifier] Io
"Hello world!" print
ou
write("Hello world!\n")
[modifier] J
'Hello world!'
[modifier] Java
/* Affichage console */ public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world!"); } }
ou
/* Affichage graphique */ public class HelloWorld { public static void main(String[] args) { javax.swing.JOptionPane.showMessageDialog(null, "Hello world!"); } }
[modifier] JavaScript / HTML DOM
En javascript :
document.write("Hello world!");
Cela peut être inclus dans du HTML de cette manière :
<script type="text/javascript"> document.write("Hello world!"); </script>
Ou par l'appel à une fonction :
<script type="text/javascript"> alert("Hello world!"); </script>
[modifier] JSP
<% out.println(" Hello World"); %>
[modifier] Kogut
WriteLine "Hello world!"
[modifier] Langage machine
Pour x86, obtenu par compilation d'assembleur FASM
en binaire :
10111010 00010000 00000001 10110100 00001001 11001101 00100001 00110000 11100100 11001101 00010110 10111000 00000000 01001100 11001101 00100001 01001000 01100101 (he) 01101100 01101100 (ll) 01101111 00100000 (o ) 01010111 01101111 (wo) 01110010 01101100 (rl) 01100100 00100001 (d!) 00100100 ($)
en hexadécimal : BA 10 01 B4 09 CD 21 30 E4 CD 16 B8 00 4C CD 21 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 24
[modifier] LaTeX
\documentclass{minimal}
\begin{document}
Hello world!
\end{document}
[modifier] Lingo pour Director 8.5 et plus
put "Hello world!"
ou
mbtext = member(#text).new() mbtext.text = "Hello world!"
[modifier] Linotte
Hello World : affichage : rôles : t :: texte <- "Hello, World !" actions : affiche t
[modifier] Lisaac
Section Header
+ name := HELLO_WORLD;
Section Public
- main <-
(
"Hello world !".println;
);
[modifier] Lisp
(write-line "Hello World!")
[modifier] Logo
print [Hello world!]
ou
pr [Hello world!]
en mswlogo seulement
messagebox [Hi] [Hello world!]
[modifier] LOLCODE
HAI CAN HAS STDIO? VISIBLE "HELLO WORLD!" KTHXBYE
[modifier] LSL (Linden Scripting Language)
default
{state_entry() //(évennement)Losrque le Script est réinitialisé
{llSay(0, "Hello, Avatar!");} //(fonction) dit "Hello Avatar" sur le channel 0
touch_start(integer total_number) //(évennement)Losrque l'objet contenant le Script est touché
{llSay(0, "Touched.");} //(fonction) dit "Hello Avatar" sur le channel 0
}
[modifier] Lua
print("Hello world!")
[modifier] Lua sur PSP
screen:print(00,10,"Hello World", 255,0,0)
[modifier] Malbolge
(=<`:9876Z4321UT.-Q+*)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk**
hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@98\6543W10/.R,+O<
[modifier] MATLAB
disp('Hello world');
ou
fprintf('Hello world\n');
[modifier] METAFONT
message "Hello world!"; bye
[modifier] mIRC Script
echo -a Hello World!
[modifier] M (MUMPS)
W "Hello world!"
[modifier] Modula-2
MODULE Hello;
FROM Terminal2 IMPORT WriteLn, WriteString;
BEGIN
WriteString("Hello world!");
WriteLn;
END Hello.
[modifier] MS-DOS batch
Utilisé avec l'interpreteur standard command.com. Le symbole « @ » est optionnel et évite au système de répéter la commande avant de l'exécuter. Le symbole doit être enlevé avec les versions de MS-DOS antérieures au 5.0.
@echo Hello world!
pause
[modifier] MUF
: main
me @ "Hello world!" notify
;
[modifier] MXML
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Label text="Hello world!"/> </mx:Application>
[modifier] NSIS
Name "Hello, world" OutFile "helloworld.exe" Section .main ; En tant qu'action courante DetailPrint "Hello, world !" ; Sur une boîte de dialogue MessageBox MB_OK "Hello, world !" SectionEnd
[modifier] Objective C
#import <Foundation/Foundation.h> int main () { NSLog(@"Hello world!"); return 0; }
[modifier] Objective Caml
Cf. #Caml. Cet exemple vaut aussi pour le F#.
print_endline "Hello world"
[modifier] Octave
#!/usr/bin/octave
disp("hello world")
[modifier] Ook
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook! Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook. Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook. Ook. Ook? Ook. Ook. Ook! Ook. Ook. Ook? Ook! Ook.
[modifier] OpenLaszlo
<canvas> <text>Hello world</text> </canvas>
[modifier] OPL
PROC hello:
PRINT "Hello world!"
ENDP
[modifier] OPS5
(object-class request
^action)
(startup
(strategy MEA)
(make request ^action hello)
)
(rule hello
(request ^action hello)
-->
(write |Hello world!| (crlf))
)
[modifier] Oz
{Browse 'Hello world !'}
[modifier] Pascal
PROGRAM salutation; // Facultatif BEGIN writeln('Hello world!'); readln; // Nécessaire pour marquer une pause à la fin de l'affichage, à défaut le programme termine. END.
[modifier] PDF
%PDF-1.3
1 0 obj
<< /Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R
>>
endobj
2 0 obj
<< /Type /Outlines
/Count 0
>>
endobj
3 0 obj
<< /Type /Pages
/Kids [4 0 R]
/Count 1
>>
endobj
4 0 obj
<< /Type /Page
/Parent 3 0 R
/MediaBox [0 0 612 792]
/Contents 5 0 R
/Resources << /ProcSet 6 0 R
/Font << /F1 7 0 R >>
>>
>>
endobj
5 0 obj
<< /Length 73 >>
stream
BT
/F1 24 Tf
100 100 Td
(Hello World) Tj
ET
endstream
endobj
6 0 obj
[/PDF /Text]
endobj
7 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /MacRomanEncoding
>>
endobj
xref
0 8
0000000000 65535 f
0000000009 00000 n
0000000074 00000 n
0000000120 00000 n
0000000179 00000 n
0000000364 00000 n
0000000466 00000 n
0000000496 00000 n
trailer
<< /Size 8
/Root 1 0 R
>>
startxref
625
%%EOF
[modifier] Perl
#!/usr/bin/perl print "Hello world!\n";
[modifier] Perl 6 et 5.10
say "Hello world";
[modifier] PHP
<?php echo "Hello world!"; // On peut aussi utiliser les guillemets simples echo 'Hello World!'; ?>
ou
<?php print ("Hello world!"); ?>
ou (version printf() du c)
<?php printf("%s %s","Hello","world!"); ?>
Ou encore en version raccourcie (supporté uniquement si short_open_tag explicitement activé)
<?="Hello world!"?>
[modifier] Piet
[modifier] PlanFacile
#start{0}#message{Hello world !}
[modifier] PL/I
hello: procedure options(main); display ('Hello world!'); /* Ou, variante : put skip list ('Hello world!'); */ end hello;
[modifier] PL/SQL
SET SERVEROUTPUT ON
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello world!');
END;
[modifier] PL/pgSQL
CREATE FUNCTION hello_world() RETURNS VOID AS $$ BEGIN RAISE NOTICE 'Hello World'; END $$ LANGUAGE 'plpgsql' VOLATILE;
[modifier] POP-11
'Hello world!' =>
[modifier] POV-Ray
#include "colors.inc" camera { location <3, 1, -10> look_at <3,0,0> } light_source { <500,500,-1000> White } text { ttf "timrom.ttf" "Hello world!" 1, 0 pigment { White } }
Ce qui donnera :
[modifier] PostScript
%!PS /Helvetica 100 selectfont 10 300 moveto (Hello, world !) show showpage
[modifier] PROC (langage de commande Pick)
001 PQ 002 C Affiche 'Hello, world !' à l'écran 003 OHello, world ! 004 X
[modifier] Processing
println("Hello World!");
[modifier] Prolog
:- write('Hello world!'), nl. === [[PureBasic]] === <source lang="purebasic"> OpenConsole() PrintN("Hello World!") ;ou en mode fenêtré MessageRequester("Titre","Hello World")
[modifier] Pure Data
[modifier] Python
print "Hello world!"
ou depuis version 3.0:
print("Hello world!")
ou graphique:
try: import Tkinter as Tk except: import tkinter as Tk #Pour les versions 3.X root = Tk.Tk("hello world") lbl = Tk.Label(root, text="Hello world") lbl.pack() root.mainloop()
[modifier] R
cat("Hello World!\n")
ou:
print("Hello World!")
[modifier] Rebol
print "Hello world!"
[modifier] Reia
"Hello world!".puts()
[modifier] REXX, NetRexx, et Object REXX
say "Hello world!"
ou:
say 'Hello world!'
[modifier] RPG
[modifier] Syntaxe libre
/FREE
DSPLY 'Hello, world!';
*InLR = *On;
/END-FREE
[modifier] Syntaxe traditionnelle
Avec cette syntaxe, une constante doit être utilisée car seules les positions 12 à 25 peuvent être utilisées pour contenir le message.
d TestMessage c Const( 'Hello, world!' )
c TestMessage DSPLY
c EVAL *InLR = *On
[modifier] RPL
(Sur les calculatrices Hewlett-Packard HP-28, HP-48 et HP-49.)
<<
CLLCD
"Hello world!" 1 DISP
0 WAIT
DROP
>>
[modifier] RTE from TradeXpress
begin
print("Hello world!",NL)
endbegin
[modifier] Ruby
puts "Hello world!"
[modifier] Ruby on Rails
render :text => "Hello, world!"
[modifier] Sather
class HELLO_WORLD is main is #OUT+"Hello world!\n"; end; end;
[modifier] Scala
object HelloWorld extends App { println("Hello world!"); }
[modifier] Scilab
disp("Hello World");
[modifier] Scheme
(display "Hello world!")
(newline)
[modifier] sed
sed -ne '1s/.*/Hello world!/p'
ou
sed "i\ Hello World" << EOF EOF
[modifier] Seed (JavaScript)
#!/usr/bin/env seed print("Hello, world!");
[modifier] Seed7
$ include "seed7_05.s7i";
const proc: main is func
begin
writeln("Hello world!");
end func;
[modifier] Self
'Hello world!' print.
[modifier] Shell Unix
#!/bin/sh
echo "Hello world!"
[modifier] Simula
BEGIN outtext("Hello World!"); outimage; END;
[modifier] Silscript
Intr-aff-{
aff[Hello world!];
}Stop-aff-
[modifier] Smalltalk
Transcript show: 'Hello world!'
Ou
self inform: 'Hello world!'
[modifier] SML
print "Hello world!\n";
[modifier] SNOBOL
OUTPUT = "Hello world!"
END
[modifier] Spoon
1111111111001000101111111010111111111101011101010110110110110000 0110101100101001010010101111111001010001010111001010010110010100 1101111111111111111100101001000101011100101000000000000000000000 10100000000000000000000000000010100101001010010001010
[modifier] SQL
create table MESSAGE (TEXT char(15));
insert into MESSAGE (TEXT) values ('Hello world!');
select TEXT from MESSAGE;
drop table MESSAGE;
Ou (ex : en Oracle)
SELECT 'Hello world!' FROM dual;
Ou (ex en: MySQL)
select 'Hello world!';
Ou, plus simplement
print 'Hello world!'
Ou (pour le KB-SQL)
SELECT NULL FROM DATA_DICTIONARY.SQL_QUERY
FOOTER ''OR HEADER OR DETAIL OR FINAL event''
WRITE "Hello world!"
[modifier] STARLET
RACINE: HELLO_WORLD.
NOTIONS:
HELLO_WORLD : ecrire("Hello world!").
[modifier] TACL
#OUTPUT Hello world!
[modifier] Tcl
puts "Hello world!"
[modifier] Tcl/Tk
pack [button .b -text "Hello world!" -command exit]
[modifier] TeX
Hello world!
\bye
[modifier] Turbo Pascal
program Hello_World; {titre du programme, facultatif} begin writeln('Hello World'); {affiche le message et saute une ligne} readln; {Sert de pause, facultatif} end.
[modifier] Turing
put "Hello world!"
[modifier] TSQL
Declare @Output varchar(16) Set @Output='Hello world!' Select @Output
ou, variation plus simple:
Select 'Hello world!' Print 'Hello world!'
[modifier] TI-59
Texas Instruments TI 58, TI 58C, TI 59 : Ce code imprime HELLO WORLD! sur l'imprimante thermique
000 69 OP 001 00 00 efface la ligne 002 02 2 003 03 3 H 004 01 1 005 07 7 E 006 69 OP 007 01 01 dans la zone de gauche 008 02 2 009 07 7 L 010 02 2 011 07 7 L 012 03 3 013 02 2 O 014 00 0 015 00 0 espace 016 04 4 017 03 3 W 018 69 OP 019 02 02 dans la zone milieu-gauche 020 03 3 021 02 2 O 022 03 3 023 05 5 R 024 02 2 025 07 7 L 026 01 1 027 06 6 D 028 07 7 029 03 3 ! 030 69 OP 031 03 03 dans la zone milieu-droit 032 69 OP 033 05 05 imprime la ligne 034 91 R/S arrêt du programme
ou avec le TI Compiler (voir page sur la TI-59):
ClrLine
"HE <<line
"LLO_W <line
"ORLD! line>
PrtLine
R/S
[modifier] TI-82 (calculatrice graphique)
Disp "HELLO WORLD!"
[modifier] TI-Basic
Ti 80 à Ti 92 :
:Disp "Hello world!"
ou plus simplement :
:Disp "Hello World!
ou
:Output(X,Y,"Hello world!")
ou plus simplement :
:Output(X,Y,"Hello World!
Où X représente la ligne et Y la colonne.
[modifier] Vala
public class HelloWorld { public static int main(string[] args) { print("Hello world!"); return 0; } }
[modifier] Verilog
module main; initial begin $display("Hello, world"); $finish ; end endmodule
[modifier] VHDL
use std.textio.all; ENTITY hello IS END ENTITY hello; ARCHITECTURE Wiki OF hello IS CONSTANT message : string := "hello world"; BEGIN PROCESS variable L: line; BEGIN write(L, message); writeline(output, L); wait; END PROCESS; END ARCHITECTURE Wiki;
[modifier] VBA (Visual Basic for Application)
Sub Main MsgBox "Hello world!" End Sub
[modifier] Visual Basic .NET (Application Console)
Imports System Public Shared Sub Main() Console.WriteLine("Hello World!") End Sub
[modifier] Visual Basic .NET (Application Windows Forms)
Imports System.Windows.Forms Public Shared Sub Main() MessageBox.Show("Hello World!") End Sub
Ou
Imports System.Windows.Forms Public Shared Sub Main() MsgBox("Hello World!") End Sub
[modifier] Visual DialogScript 2,3,4 et 5
Title Hello World! Info Hello World!
[modifier] Whitespace
empty-line empty-line empty-line empty-line empty-line empty-line empty-line/EOF
[modifier] XSLT (eXtensible Stylesheet Language Transformations)
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/">Hello world!</xsl:template> </xsl:stylesheet>
[modifier] XUL
<?xml version="1.0" encoding="ISO-8859-1" ?> <window title="Hello world" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <description>Hello world</description> <label value="Hello world" /> </window>
[modifier] YaBasic
print "Hello world"
ou
print @(1,1) "Hello world"
ou
open window 30,100 text 1,20,"Hello world"
[modifier] Apparition dans d'autres contextes
[modifier] Art
Dans (2009) Hello, World, 007485 fait apparaître la mention en utilisant la plateforme youtube[2].
[modifier] Notes et références
- [1]
- 007485.com, site Internet de 007485


