Hello world - Wikipédia

Transcription

Hello world - Wikipédia
Hello world - Wikipédia
01/09/07 18:13
Hello world
Un article de Wikipédia, l'encyclopédie libre.
Pour les articles homonymes? , voir Hello (homonymie).
En informatique, pour la démonstration rapide d'un langage de programmation (par exemple à but
pédagogique) ou le test d'un compilateur, il est de tradition d'écrire un petit programme, aussi simple que
possible, dont le seul but soit l'affichage à l'écran des mots hello world (bonjour le monde).
Certains 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).
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é influencé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]
(http://cm.bell-labs.com/cm/cs/who/dmr/bintro.html) .
Aujourd'hui on affiche plus souvent Hello world! comme une phrase, avec majuscule et point d'exclamation
final.
Sommaire
1 Exemples de programmes Hello world!
1.1 ABC
1.2 ActionScript
1.3 Ada
1.4 Alma
1.5 AmigaE
1.6 APL
1.7 AppleScript
1.8 ASP et ASP.NET
1.9 AspectJ
1.10 Assembleur de Bytecode Java
1.11 Assembleur x86 sous DOS
1.12 Assembleur x86, écrit pour l'assembleur TASM sous DOS
1.13 Assembleur x86, sous Linux, écrit pour l'assembleur NASM
1.14 Awk
1.15 BASIC
1.16 Bash
1.17 BCPL
http://fr.wikipedia.org/wiki/Hello_world
Page 1 of 30
Hello world - Wikipédia
01/09/07 18:13
1.18 Befunge
1.19 Bliss
1.20 Brainfuck
1.21 C
1.22 C (uniquement sous windows)
1.23 C (uniquement sur PSP)
1.24 C# (en Console)
1.25 C# (Application Windows)
1.26 C++
1.27 Caml
1.28 Casio (calculatrices graphiques de la gamme «Graph xx»)
1.29 CIL
1.30 Clean
1.31 CLIST
1.32 COBOL
1.33 Common Lisp
1.34 D
1.35 Delphi
1.36 Dialog/Xdialog
1.37 DCL batch
1.38 Ed et Ex (Ed extendu)
1.39 Eiffel
1.40 Erlang
1.41 EUPHORIA
1.42 Forte TOOL
1.43 Forth
1.44 Fortran (ANSI 77)
1.45 Frink
1.46 Gambas
1.47 GML (Game Maker Language)
1.48 Gnuplot
1.49 GOTO++
1.50 Groovy
1.51 Haskell
1.52 Heron
1.53 HP-41 et HP-42S
1.54 HP-40 G
1.55 HTML
1.56 XHTML 1.0 Strict
1.57 ICON
1.58 Iptscrae
1.59 Io
1.60 Java
1.61 JavaScript / HTML DOM
1.62 Kogut
1.63 LaTeX
1.64 Linotte
1.65 Lisaac
1.66 Lisp
1.67 Logo
1.68 Lua
http://fr.wikipedia.org/wiki/Hello_world
Page 2 of 30
Hello world - Wikipédia
01/09/07 18:13
1.69 MATLAB
1.70 mIRC Script
1.71 M (MUMPS)
1.72 Modula-2
1.73 MS-DOS batch
1.74 MUF
1.75 Objective C
1.76 Ocaml
1.77 Octave
1.78 OPL
1.79 OPS5
1.80 Pascal
1.81 PDF
1.82 Perl
1.83 Perl 6
1.84 PHP
1.85 PlanFacile
1.86 PL/I
1.87 PL/SQL
1.88 POP-11
1.89 POV-Ray
1.90 PostScript
1.91 Prolog
1.92 PureBasic
1.93 Python
1.94 Rebol
1.95 REXX, NetRexx, et Object REXX
1.96 RPG
1.96.1 Syntaxe libre
1.96.2 Syntaxe traditionnelle
1.97 RPL
1.98 Ruby
1.99 Ruby on Rails
1.100 Sather
1.101 Scala
1.102 Scilab
1.103 Scheme
1.104 sed
1.105 Seed7
1.106 Self
1.107 Shell UNIX
1.108 Simula
1.109 Silscript
1.110 Smalltalk
1.111 SML
1.112 SNOBOL
1.113 SQL
1.114 STARLET
1.115 TACL
1.116 Tcl
1.117 Tcl/Tk
http://fr.wikipedia.org/wiki/Hello_world
Page 3 of 30
Hello world - Wikipédia
01/09/07 18:13
1.118 Turbo Pascal
1.119 Turing
1.120 TSQL
1.121 TI-Basic
1.122 Verilog
1.123 VHDL
1.124 Visual Basic
1.125 Visual Basic .Net (Application Console)
1.126 Visual Basic .Net (Application Windows Forms)
1.127 Visual DialogScript 2,3,4 et 5
1.128 XUL
2 Liens externes
Exemples de programmes Hello world!
ABC
WRITE "Hello world!"
ActionScript
trace("Hello world!");
this.createTextField("champ",this.getNextHighestDepth(),0,20,200,20);
champ.text = "Hello World !";
Ada
with Ada.Text_IO;
use Ada.Text_IO;
procedure Bonjour is
begin -- Bonjour
Put("Hello world!");
end Bonjour;
Alma
Hello world!
AmigaE
PROC main()
WriteF('Hello world!')
ENDPROC
http://fr.wikipedia.org/wiki/Hello_world
Page 4 of 30
Hello world - Wikipédia
01/09/07 18:13
APL
'Hello world!'
(L'une des bases d'APL est que toute expression qui, après exécution, n'est pas affectée à une variable voit
son contenu affiché au terminal)
AppleScript
display dialog "Hello world!"
ASP et ASP.NET
<%
Response.Write("Hello World")
%>
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!" );
}
}
Assembleur de Bytecode Java
Ce code fonctionne avec les assembleurs Jasmin et Oolong.
Les commentaires sont situés après un ';'
.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
http://fr.wikipedia.org/wiki/Hello_world
Page 5 of 30
Hello world - Wikipédia
01/09/07 18:13
aload_0
; appel statiquement lié aux contructeur 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
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
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
Assembleur x86, sous Linux, écrit pour l'assembleur NASM
section .data
helloMsg:
helloSize:
section .text
db 'Hello world!',10
equ $-helloMsg
http://fr.wikipedia.org/wiki/Hello_world
Page 6 of 30
Hello world - Wikipédia
01/09/07 18:13
global _start
_start:
mov eax,4
mov ebx,1
mov ecx, helloMsg
mov edx, helloSize
int 80h
; Sortie du programme
mov eax,1
mov ebx,0
int 80h
; Appel système "write" (sys_write)
; File descriptor, 1 pour STDOUT (sortie standard)
; Adresse de la chaîne a afficher
; Taille de la chaîne
; Execution de l'appel système
; Appel système "exit"
; Code de retour
Awk
BEGIN { print "Hello world!" }
BASIC
10 PRINT "Hello world!"
20 END
Noter que 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).
Bash
echo 'Hello world'
BCPL
GET "LIBHDR"
LET START () BE
$(
WRITES ("Hello world!*N")
$)
Befunge
<q_,#! #:<"Hello world!"a
Bliss
%TITLE 'hassan'
MODULE HELLO_WORLD (IDENT='V1.0', MAIN=HELLO_WORLD,
ADDRESSING_MODE (EXTERNAL=GENERAL)) =
BEGIN
http://fr.wikipedia.org/wiki/Hello_world
Page 7 of 30
Hello world - Wikipédia
01/09/07 18:13
LIBRARY 'SYS$LIBRARY:STARLET';
EXTERNAL ROUTINE
LIB$PUT_OUTPUT;
=HELLO_WORLD =
BEGIN
LIB$PUT_OUTPUT(%ASCID %STRING('Hello world!'))
END;
END
ELUDOM
Brainfuck
++++++++[>+++++++++<-]>.>+++++++[<++++>-]<+.+++
++++..+++.>++++[>++++++++<-]>.[-]<<++++++++.-------.+++.------.--------.>++++++++[->++++<]>+.
C
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello world!\n");
return 0;
}
int main(void)
{
puts("Hello world");
return 0;
}
C (uniquement sous windows)
#include <windows>
int WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{
MessageBox( NULL, "Hello world!\n", "", MB_OK );
return 0;
}
C (uniquement sur PSP)
#include <pspkernel.h>
#include <pspdebug.h>
PSP_MODULE_INFO("Hello World", 0, 1, 1);
#define printf pspDebugScreenPrintf
http://fr.wikipedia.org/wiki/Hello_world
Page 8 of 30
Hello world - Wikipédia
01/09/07 18:13
/* 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 = 0;
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;
}
C# (en Console)
using System;
public class HelloWorld {
public static void Main () {
Console.WriteLine("Hello world!");
}
}
C# (Application Windows)
using System.Windows.Forms;
public class HelloWorld
{
public static void Main() {
MessageBox.Show("Hello world!");
}
}
http://fr.wikipedia.org/wiki/Hello_world
Page 9 of 30
Hello world - Wikipédia
01/09/07 18:13
C++
#include <iostream>
int main()
{
std::cout << "Hello world!" << std::endl;
return 0;
}
ou
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
Caml
print_string("Hello world!");;
Ou
(* Fichier hello.ml*)
let hello () =
print_string("Hello world!");
print_newline();;
let main () =
hello();
exit(0);;
main();;
Casio (calculatrices graphiques de la gamme «Graph xx»)
"Hello world!"
ou :
Locate 1,1,"Hello world!"
ou encore :
Text 1,1,"Hello world!"
http://fr.wikipedia.org/wiki/Hello_world
Page 10 of 30
Hello world - Wikipédia
01/09/07 18:13
CIL
.method public static void Main() cil managed
{
.entrypoint
.maxstack 8
ldstr "Hello world!."
call void [mscorlib]System.Console::WriteLine(string)
ret
}
Clean
module hello
Start :: String
Start = "Hello world!"
CLIST
PROC 0
WRITE Hello world!
COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "Hello world!".
STOP RUN.
Common Lisp
(princ "Hello world!")
D
import std.stdio;
int main (char[][] args)
{
printf ("Hello world!\n");
}
Delphi
http://fr.wikipedia.org/wiki/Hello_world
Page 11 of 30
Hello world - Wikipédia
01/09/07 18:13
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.
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
DCL batch
$ write sys$output "Hello world!"
Ed et Ex (Ed extendu)
a
Hello world!
.
p
ou comme ceci:
echo -e 'a\nHello world!\n.\np'|ed
echo -e 'a\nHello world!\n.\np'|ex
Eiffel
http://fr.wikipedia.org/wiki/Hello_world
Page 12 of 30
Hello world - Wikipédia
01/09/07 18:13
class HELLO_WORLD
creation
make
feature
make is
do
io.put_string("Hello world!%N")
end -- make
end -- class HELLO_WORLD
Erlang
-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("Hello world!\n").
EUPHORIA
puts(1, "Hello world!")
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
http://fr.wikipedia.org/wiki/Hello_world
Page 13 of 30
Hello world - Wikipédia
01/09/07 18:13
CompatibilityLevel = 0;
ProjectType = APPLICATION;
Restricted = FALSE;
MultiThreaded = TRUE;
Internal = FALSE;
LibraryName = 'hellowor';
StartingMethod = (class = Hello, method = Init);
end HelloWorld;
Forth
." Hello world!" CR
Fortran (ANSI 77)
PROGRAM BONJOUR
WRITE (*,*) 'Hello world!'
END
Frink
println["Hello world!"]
Gambas
PUBLIC SUB Main()
Print "Hello world!"
END
GML (Game Maker Language)
draw_text(x, y,"Hello world!");
Gnuplot
#! /usr/bin/gnuplot
print "hello world"
GOTO++
GOTOPRINTDUTEXTE() ; «Hello world!»
Groovy
http://fr.wikipedia.org/wiki/Hello_world
Page 14 of 30
Hello world - Wikipédia
01/09/07 18:13
print "hello world"
Haskell
module HelloWorld (main) where
main = putStrLn "Hello world!"
Heron
program HelloWorld;
functions {
_main() {
String("Hello world!") |> GetStdOut();
}
}
end
HP-41 et HP-42S
(calculatrice Hewlett-Packard alphanumérique)
01 LBL T HELLO
02 T HELLO, WORLD
03 PROMPT
HP-40 G
(calculatrice Hewlett-Packard)
DISP 1;"HELLO WORLD !":
FREEZE:
HTML
<html>
<body>
Hello world!
</body>
</html>
XHTML 1.0 Strict
http://fr.wikipedia.org/wiki/Hello_world
Page 15 of 30
Hello world - Wikipédia
01/09/07 18:13
<!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="text/html; charset=ISO-8859-1" />
<title>Dire «Hello world!» en XHTML 1.0 Strict</title>
</head>
<body>
<p>Hello world!</p>
</body>
</html>
ICON
procedure main()
write("Hello World !")
end
Iptscrae
ON ENTER {
"Hello " "world!" & SAY
}
Io
"Hello world!" print
ou
write("Hello world!\n")
Java
Note: Le fichier doit absolument s'appeler HelloWorld.java (même nom que la classe)
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
Note: Pour utiliser cette façon on doit importer javax.swing.
public class HelloWorld
{
http://fr.wikipedia.org/wiki/Hello_world
Page 16 of 30
Hello world - Wikipédia
01/09/07 18:13
public static void main(String[] args)
{
JOptionPane.showMessageDialog(null,"Hello world!");
}
}
JavaScript / HTML DOM
En javascript :
document.write("Hello world!");
Cela peut être inclus dans du HTML de cette manière :
<script type="text/javascript" language="javascript">
document.write("Hello world!");
</script>
Ou par l'appel à une fonction :
<script type="text/javascript" language="javascript">
function hello()
{
alert("Hello world!");
}
</script>
<input type="button" onclick="javascript:hello()" />
Kogut
WriteLine "Hello world!"
LaTeX
\documentclass{article}
\begin{document}
Hello world!
\end{document}
Linotte
Livre : HelloWorld
Paragraphe : Affichage
Les rôles :
exemple est un texte avec "Hello,"
Les actions :
tu affiches l' exemple
tu affiches "World !"
http://fr.wikipedia.org/wiki/Hello_world
Page 17 of 30
Hello world - Wikipédia
01/09/07 18:13
Lisaac
section HEADER
+ name
:= HELLO_WORLD;
- category
:= MACRO;
section INHERIT
- parent_object:OBJECT := OBJECT;
section PUBLIC
- make <(
"Hello world !\n".print;
);
Lisp
(write-line "Hello World!")
Logo
print [Hello world!]
ou
pr [Hello world!]
en mswlogo seulement
messagebox [Hi] [Hello world!]
Lua
print "Hello world!"
MATLAB
disp('Hello world')
mIRC Script
echo -a Hello World!
M (MUMPS)
W "Hello world!"
http://fr.wikipedia.org/wiki/Hello_world
Page 18 of 30
Hello world - Wikipédia
01/09/07 18:13
Modula-2
MODULE Hello;
FROM Terminal2 IMPORT WriteLn; WriteString;
BEGIN
WriteString("Hello world!");
WriteLn;
END Hello;
MS-DOS batch
(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!
MUF
: main
me @ "Hello world!" notify
;
Objective C
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]] init];
NSLog(@"Hello world!");
[pool release];
return 0;
}
Ocaml
Cf. Caml. Cet exemple vaut aussi pour le F#.
type data =
{ first: string;
second: string; }
let myData =
{ first="Hello";
second="world"; }
let _ =
http://fr.wikipedia.org/wiki/Hello_world
Page 19 of 30
Hello world - Wikipédia
01/09/07 18:13
print_string myData.first;
print_string " ";
print_endline myData.second;
Octave
#!/usr/bin/octave
disp("hello world")
OPL
PROC hello:
PRINT "Hello world!"
ENDP
OPS5
(object-class request
^action)
(startup
(strategy MEA)
(make request ^action hello)
)
(rule hello
(request ^action hello)
-->
(write |Hello world!| (crlf))
)
Pascal
program Bonjour;
Uses WinCrt;
begin
WriteLn('Hello world!');
end.
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
>>
http://fr.wikipedia.org/wiki/Hello_world
Page 20 of 30
Hello world - Wikipédia
01/09/07 18:13
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
0000000009
0000000074
0000000120
0000000179
0000000364
0000000466
0000000496
65535
00000
00000
00000
00000
00000
00000
00000
f
n
n
n
n
n
n
n
trailer
<< /Size 8
/Root 1 0 R
>>
startxref
625
%%EOF
Perl
#!usr/bin/perl
print "Hello world!\n";
http://fr.wikipedia.org/wiki/Hello_world
Page 21 of 30
Hello world - Wikipédia
01/09/07 18:13
Perl 6
say "Hello world";
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!");
?>
et encore (en version raccourci)
<?="Hello world!"?>
PlanFacile
#start{0}#message{Hello world !}
ou pour les amateurs d'IOCCC
#define{d}{r}#define{r}{H#2#1#H#define{r}{#1#1}}
#H{#h{#r{#r{#e}#define{H}{#l}}{e}}{#define{d}{# }!}
{#h{#l}{#o}{#w{w}}#e#define{h}{#3#define{o}{r}#1#2}
#w{d}{#d}#define{w}{#0}}#define{h}{#1#d#3#2}#define{e}
{l}}#start{0}#define{H}{#foot{#1#define{l}{o}}}
PL/I
hello: procedure options(main);
display ('Hello world!');
/* Ou, variante : put skip list ('Hello world!'); */
http://fr.wikipedia.org/wiki/Hello_world
Page 22 of 30
Hello world - Wikipédia
01/09/07 18:13
end hello;
PL/SQL
SET SERVEROUTPUT ON
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello world!');
END;
POP-11
'Hello world!' =>
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 }
}
PostScript
%!PS
100 /Helvetica findfont exch scalefont setfont
10 300 moveto
(Hello, world !) show
showpage
Prolog
write('Hello world!'), nl.
PureBasic
OpenConsole()
PrintN("Hello World!")
Python
print "Hello world!"
http://fr.wikipedia.org/wiki/Hello_world
Page 23 of 30
Hello world - Wikipédia
01/09/07 18:13
Rebol
print "Hello world!"
REXX, NetRexx, et Object REXX
say "Hello world!"
ou:
say 'Hello world!'
RPG
Syntaxe libre
/FREE
DSPLY 'Hello, world!';
*InLR = *On;
/END-FREE
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
c
TestMessage
c
Const( 'Hello, world!' )
DSPLY
EVAL
*InLR = *On
RPL
(Sur les calculatrices Hewlett-Packard HP-28, HP-48 et HP-49.)
<<
CLLCD
"Hello world!" 1 DISP
0 WAIT
DROP
>>
Ruby
http://fr.wikipedia.org/wiki/Hello_world
Page 24 of 30
Hello world - Wikipédia
01/09/07 18:13
puts "Hello world!"
Ruby on Rails
render :text => "Hello, world!"
Sather
class HELLO_WORLD is
main is
#OUT+"Hello world!\n";
end;
end;
Scala
object HelloWorld with Application {
Console.println("Hello world!");
}
Scilab
disp("Hello World");
Scheme
(display "Hello world!")
(newline)
sed
(note: requiert au moins une ligne en entrée)
sed -ne '1s/.*/Hello world!/p'
Seed7
$ include "seed7_05.s7i";
const proc: main is func
begin
writeln("Hello world!");
end func;
http://fr.wikipedia.org/wiki/Hello_world
Page 25 of 30
Hello world - Wikipédia
01/09/07 18:13
Self
'Hello world!' print.
Shell UNIX
#!/bin/sh
echo "Hello world!"
Simula
BEGIN
outtext("Hello World!");
outimage;
END;
Silscript
Intr-aff-{
aff[Hello world!];
}Stop-aff-
Smalltalk
Transcript show: 'Hello world!'
Ou
self inform: 'Hello world!'
SML
print "Hello world!\n";
SNOBOL
OUTPUT = "Hello world!"
END
SQL
create table MESSAGE (TEXT char(15));
insert into MESSAGE (TEXT) values ('Hello world!');
http://fr.wikipedia.org/wiki/Hello_world
Page 26 of 30
Hello world - Wikipédia
01/09/07 18:13
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!"
STARLET
RACINE: HELLO_WORLD.
NOTIONS:
HELLO_WORLD : ecrire("Hello world!").
TACL
#OUTPUT Hello world!
Tcl
puts "Hello world!"
Tcl/Tk
pack [button .b -text "Hello world!" -command exit]
Turbo Pascal
program Hello_World_in_TP; {titre le programme}
http://fr.wikipedia.org/wiki/Hello_world
Page 27 of 30
Hello world - Wikipédia
01/09/07 18:13
begin
writeln ('Hello World'); {affiche le message et saute une ligne}
readln; {Sert de pause}
end.
Turing
put "Hello world!"
TSQL
Declare @Output varchar(16)
Set @Output='Hello world!'
Select @Output
ou, variation plus simple:
Select 'Hello world!'
Print 'Hello world!'
TI-Basic
Ti 80 à Ti 92 :
:Disp "Hello world!"
ou
:Output(X,Y,"Hello world!")
Où X représente la ligne et Y la colonne.
Verilog
module main;
initial
begin
$display("Hello, world");
$finish ;
end
endmodule
VHDL
use std.textio.all;
http://fr.wikipedia.org/wiki/Hello_world
Page 28 of 30
Hello world - Wikipédia
01/09/07 18:13
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;
Visual Basic
Sub Main()
MsgBox("Hello world!")
End Sub
Visual Basic .Net (Application Console)
Imports System
Public Shared Sub Main()
Console.WriteLine("Hello World!")
End Sub
Visual Basic .Net (Application Windows Forms)
Imports System.Windows.Forms
Public Shared Sub Main()
MessageBox.Show("Hello World!")
End Sub
Visual DialogScript 2,3,4 et 5
Title Hello World!
Info Hello World!
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>
Liens externes
http://fr.wikipedia.org/wiki/Hello_world
Page 29 of 30
Hello world - Wikipédia
01/09/07 18:13
99 Bottles of Beer (http://99-bottles-of-beer.ls-la.net/) (Site présentant un programme simple écrit en
plus de 1000 langages différents)
Récupérée de « http://fr.wikipedia.org/wiki/Hello_world »
Catégorie : Programmation informatique
Dernière modification de cette page le 29 août 2007 à 21:25.
Copyright : Tous les textes sont disponibles sous les termes de la licence de documentation libre
GNU (GFDL).
Wikipedia® est une marque déposée de la Wikimedia Foundation, Inc., association de bienfaisance
régie par le paragraphe 501(c)(3) du code fiscal des États-Unis.
http://fr.wikipedia.org/wiki/Hello_world
Page 30 of 30

Documents pareils