您的位置:首页 > 其它

List of Hello World Programs in 200 Programming Languages

2009-01-02 23:16 537 查看

List of Hello World Programs in 200 Programming Languages

[align=left]by Scriptol.org(http://www.scriptol.org/hello-world-programming-language.php)[/align]
[align=left] [/align]
[align=left]A complete collection of the smallest possible programs, in each existing programming language. This list is universal, comprised of programming languages and document formats. [/align]
[align=left] [/align]

A

4GL

[align=left]
message "Hello, World!" with style = popup;
[/align]

Abap

[align=left]
WRITE 'Hello, World!'.
[/align]

Abc

[align=left]
WRITE "Hello, World!"
[/align]

ActionScript

[align=left]
trace("Hello, World!");
[/align]
[align=left]
Graphical version: [/align]
[align=left]
this.createTextField("hello_txt",0,10,10,100,20);
this.hello_txt.text="Hello, World!";
[/align]

Ada

[align=left]
with TEXT_IO;

procedure HELLO is
begin
TEXT_IO.PUT_LINE ("Hello, World!");
end HELLO;
[/align]

Algol 60

[align=left]
'BEGIN'
'COMMENT' In Algol 60;
OUTPUT(4,'(''('Hello World!')',/')')
'END
[/align]

Algol 68

BEGIN
print(("Hello, World!", newline))
END

[align=left]Using the short form of begin and end:[/align]
[align=left]
( print("Hello, World!") )
[/align]

Alma-0

[align=left]
Hello, World!
[/align]

AmigaE

[align=left]
PROC main()
WriteF('Hello, World!');
ENDPROC
[/align]
[align=left]
[/align]

Apl

[align=left]
'Hello, World!'
[/align]

AppleScript

[align=left]
return "Hello, World!"
[/align]
[align=left]or: [/align]
[align=left]
-- "Hello World!"
[/align]
[align=left]Graphical: [/align]
[align=left]
display dialog "Hello World!" buttons {"OK"} default button 1
[/align]

Ascii

[align=left]In hexadecimal notation (0D = carriage return, 0A = newline):[/align]
[align=left]
48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 21 0D 0A
[/align]

Asp

[align=left]
<%
Response.Write("Hello, World!")
%>
[/align]

or
[align=left]
<%="Hello, World!" %>
[/align]

Asp.Net

[align=left]
Response.Write("Hello, World!")
[/align]

AspectJ

[align=left]
public aspect HelloWorld
{
pointcut mainCall() : call(public static void *.main(String[] args));
before() : mainCall()
{
System.out.println( "Hello World!" );
}
}
[/align]

Assembly language

6502 assembler

[align=left]
MSG: .ASCIIZ "Hello, World!"
START: LDX #0
LOOP: LDA MSG,X ; load character
JSR $FFD2 ; output to current output device
INX
BNE @LOOP
RTS
[/align]

Intel x86, Dos, Tasm

[align=left]
MODEL SMALL
IDEAL
STACK 100H
[/align]
[align=left]
DATASEG
MSG DB 'Hello, World!', 13, '$'
[/align]
[align=left]
CODESEG
Start:
MOV AX, @data
MOV DS, AX
MOV DX, OFFSET MSG
MOV AH, 09H ; output ascii string
INT 21H
MOV AX, 4C00H
INT 21H
END Start
[/align]

Intel x86, Linux

[align=left]
SECTION .data
msg:
db "Hello, World!/n"
len equ $ - msg
SECTION .text
global start
start:
mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80
mov ebx,0
mov eax,1
int 0x80
[/align]

Assembler 68000:

[align=left]
move.l #helloworld,-(A7)
move #9,-(A7)
trap #1
addq.l #6,A7
move #0,-(A7)
trap #1
helloworld:
dc.b "Hello World!",$0d,$0a,0
[/align]

Arm, Risc OS:

[align=left]
.program
ADR R0,message
SWI "OS_Write0"
SWI "OS_Exit"
.message
DCS "Hello, World!"
DCB 0
ALIGN
[/align]
or the even smaller version (from qUE);

[align=left]
SWI"OS_WriteS":EQUS"Hello, World!":EQUB0:ALIGN:MOVPC,R14
[/align]

Risc processor and Mips architecture

[align=left]
.data
msg: .asciiz "Hello, World!"
.align 2
.text
.globl main
main:
la $a0,msg
li $v0,4
syscall
jr $ra
[/align]

AutoHotkey

[align=left]
MsgBox, "Hello, World!"
[/align]

Autoit

[align=left]
MsgBox(1,'','Hello, World!')
[/align]

Avenue - Scripting language for ArcView GIS

[align=left]
MsgBox("Hello, World!","aTitle")
[/align]

Awk

[align=left]
# Hello
BEGIN { print "Hello, World!"}
[/align]

B

B

[align=left]
/* Hello */

main()
{
extern a, b, c;
putchar (a); putchar (b); putchar (c); putchar ('!*n');
}

a 'hell' ;
b 'o, w' ;
c 'orld' ;
[/align]

Bash

#!/bin/sh
echo "Hello, World!"

Basic

General

ANSI/ISO-compliant BASIC implementation. The "END" statement is optional in many implementations of BASIC.

[align=left]
10 PRINT "Hello, World!"
20 END
[/align]
Immediate mode.

[align=left]
PRINT "Hello, World!"
? "Hello, World!"
[/align]
Later implementations of BASIC. Again, the "END" statement is optional in many BASICs.

[align=left]
PRINT "Hello, World!"
END
[/align]

DarkBasic

[align=left]
PRINT "HELLO WORLD"
TEXT 0,0,"Hello, World!"
WAIT KEY
[/align]

PBasic

[align=left]
DEBUG "Hello, World!", CR
[/align]
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):

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

StarOffice/OpenOffice Basic

[align=left]
sub main
print "Hello, World!"
end sub
[/align]

Visual Basic

[align=left]
Sub Main()
Print "Hello, World!"
End Sub
[/align]

Visual Basic .Net

[align=left]
Module HelloWorldApp
Sub Main()
System.Console.WriteLine("Hello, World!")
End Sub
End Module
[/align]
or:,

[align=left]
Class HelloWorldApp
Shared Sub Main()
System.Console.WriteLine("Hello, World!")
End Sub
End Class
[/align]

Bcpl

[align=left]
// Hello

GET "LIBHDR"

LET START () BE
$(
WRITES ("Hello, World!*N")
$)
[/align]

Beta

[align=left]
{ *** Hello ***}
(#
do
'Hello World!'->putLine
#)
[/align]

Bliss

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

LIBRARY 'SYS$LIBRARY:STARLET';

EXTERNAL ROUTINE
LIB$PUT_OUTPUT;

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

END
ELUDOM
[/align]

Boo

[align=left]
print "Hello, World!"
[/align]

C

C (ANSI)

[align=left]
#include<stdio.h>

/* Hello */
int main(void)
{
printf("Hello, World!");
return 0;
}
[/align]

C Windows

[align=left]
#include
[/align]

C#

[align=left]
using System;
class HelloWorld
{
static void Main()
{
System.Console.WriteLine("Hello, World!");
}
}
[/align]

C++ (ISO)

[align=left]
#include<iostream>

int main()
{
std::cout << "Hello, World!/n";
}
[/align]

C++ / Cli

[align=left]
int main()
{
System::Console::WriteLine("Hello, World!");
}
[/align]

C++ Managed (.Net)

[align=left]
#using <mscorlib.dll>

using namespace System;

int wmain()
{
Console::WriteLine("Hello, World!");
}
[/align]

Caml light

[align=left]
(* Hello World *)

let hello =
print_string "Hello World!";
;;
[/align]

Cil

[align=left]
.method public static void Main() cil managed
{
.entrypoint
.maxstack 8
ldstr "Hello, World!"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
[/align]

Clean

[align=left]
module hello

Start = "Hello, World!"
[/align]

Clist

[align=left]
PROC 0
WRITE Hello, World!
[/align]

Clipper

[align=left]
? "Hello, World!"
[/align]

Clu

[align=left]
start_up = proc ()
po: stream := stream$primary_output ()
stream$putl (po, "Hello, World!")
end start_up
[/align]

Cobol

[align=left]
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.

ENVIRONMENT DIVISION.

DATA DIVISION.

PROCEDURE DIVISION.
DISPLAY "Hello, World!".
STOP RUN.
[/align]

Cocoa or GnuStep (Objective C)

[align=left]
#import <Cocoa/Cocoa.h>
@interface hello : NSObject {
}
@end

@implementation hello

-(void)awakeFromNib
{
NSRunAlertPanel(@"Message from your Computer", @"Hello, World!", @"Hi!",
nil, nil);
}

@end
[/align]

ColdFusion

[align=left]
<cfoutput>Hello, World!</cfoutput>
[/align]

Comal

[align=left]
PRINT "Hello, World!"
[/align]

Curl

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

Hello, World!
[/align]

D

D

[align=left]
import std.stdio ;

void main () {
writef("Hello, World!");
}
[/align]

D++

[align=left]
function main()
{
screenput "Hello, World!";
}
[/align]

Dataflex

[align=left]
/tela
Hello world
/*
clearscreen
page tela
[/align]

dBase

[align=left]
* Hello World in dBase IV
? "Hello World!"
[/align]

Dcl batch

[align=left]
$ write sys$output "Hello, World!"
[/align]

Delphi, Kylix

[align=left]
program Hello_World;
uses
Windows;

begin
ShowMessage("Hello, World!");
end.
[/align]

Doll

[align=left]
this::operator()
{
import system.cstdio;
puts("Hello, World!");
}
[/align]

Dylan

[align=left]
module: hello

format-out("Hello, World!/n");
[/align]

E

Ed and Ex (Ed extended)

[align=left]
a
hello World!
.
p
[/align]

Eiffel

[align=left]
class HELLO_WORLD

creation
make
feature
make is
local
io:BASIC_IO
do
!!io
io.put_string("%N Hello, World!")
end -- make
end -- class HELLO_WORLD
[/align]

Elan

[align=left]
(* Elan *)
putline ("Hello World!");
[/align]

Erlang

[align=left]
-module(hello).
-export([hello_world/0]).

hello_world() -> io:fwrite("Hello, World!/n").
[/align]

Euphoria

[align=left]
puts(1, "Hello, World!")
[/align]

F

F#

[align=left]
print_endline "Hello, World!"
[/align]

Factor

[align=left]
"Hello, World!" print
[/align]

filePro

[align=left]
@once:
mesgbox "Hello, World!" ; exit
[/align]

Focal

[align=left]
type "Hello, World!",!
[/align]

Focus

[align=left]
-TYPE Hello world
[/align]

Forth

[align=left]
: HELLO ( -- ) ." Hello, World!" CR ;
HELLO
[/align]

Fortran

[align=left]
 PROGRAM HELLO
PRINT *, 'Hello, World!'END
[/align]

Fril

[align=left]
?((pp "Hello, World!"))
[/align]

Frink

[align=left]
println["Hello, World!"]
[/align]

G

Gambas

[align=left]
PUBLIC SUB Main()
Print "Hello, World!"
END
[/align]
Graphical:

[align=left]
PUBLIC SUB Main()
Message.Info("Hello, World!")
END
[/align]

Groovy

[align=left]
println "Hello, World"
[/align]

Gtk+ in C++

[align=left]
#include<iostream>
#include<gtkmm/main.h>
#include<gtkmm/button.h>
#include<gtkmm/window.h>
using namespace std;

class HelloWorld : public Gtk::Window {
public:
HelloWorld();
virtual ~HelloWorld();
protected:
Gtk::Button m_button;
virtual void on_button_clicked();
};

HelloWorld::HelloWorld()
: m_button("Hello, World!") {
set_border_width(10);
m_button.signal_clicked().connect(SigC::slot(*this,
&HelloWorld::on_button_clicked));
add(m_button);
m_button.show();
}

HelloWorld::~HelloWorld() {}

void HelloWorld::on_button_clicked() {
cout << "Hello, World!" << endl;
}

int main (int argc, char *argv[]) {
Gtk::Main kit(argc, argv);
HelloWorld helloworld;
Gtk::Main::run(helloworld);
return 0;
}
[/align]

Gtk# in C#

[align=left]
using Gtk;
using GtkSharp;
using System;

class Hello {

static void Main()
{
Application.Init ();

Window window = new Window("");
window.DeleteEvent += cls_evn;
Button close = new Button ("Hello world");
close.Clicked += new EventHandler(cls_evn);

window.Add(close);
window.ShowAll();

Application.Run ();

}

static void cls_evn(object obj, EventArgs args)
{
Application.Quit();
}

}
[/align]

H

Haskell

[align=left]
module Main (main) where

main = putStrLn "Hello, World!"
[/align]

Heron

[align=left]
program HelloWorld;
functions {
_main() {
print_string("Hello, World!");
}
}
end
[/align]

HLA (High Level Assembly)

[align=left]
program helloWorld;
#include("stdlib.hhf")
begin helloWorld;

stdout.put( "Hello World" nl );

end helloWorld;
[/align]

HP-41, HP-42S

Hewlett-Packard RPN-based alphanumeric engineering calculators.

[align=left]
01 LBLTHELLO
02 THELLO, WORLD
03 PROMPT
[/align]

Html

[align=left]
<html>
<body>
Hello, World!
</body>
</html>
[/align]
HTML 4.01 Strict

[align=left]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hello, World!</title>
</head>
<body>
<p>Hello, World!</p>
</body>
</html>
[/align]

HyperTalk

Apple HyperCard's scripting programming language.

[align=left]
put "Hello, World!"
[/align]
or

[align=left]
Answer "Hello, World!"
[/align]

I

Icon

[align=left]
# In Icon
procedure main()
write("Hello world")
end
[/align]

IDL

[align=left]
print,"Hello World!"
[/align]

Inform

[align=left]
[ Main;
"Hello, World!";
];
[/align]

Intercal

[align=left]
IN INTERCAL
HELLO WORLD
[/align]

Io

[align=left]
"Hello, World!" print
[/align]
or

[align=left]
write("Hello, World!/n")
[/align]

Iptscrae

[align=left]
ON ENTER {
"Hello, " "World!" & SAY
}
[/align]

J

J

[align=left]
'Hello world'
[/align]

Java

[align=left]
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
[/align]

Java byte-code

Disassembler output of javap -c HelloWorld.

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

Java Swing

[align=left]
import javax.swing.JOptionPane;

public class Hello
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog(null, "Hello, World!");
}
}
[/align]

Java SWT

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

Java applet

[align=left]Java applets work in conjunction with HTML files. [/align]
[align=left]
<HTML>
<HEAD>
<TITLE>Hello world</TITLE>
</HEAD>
<BODY>

HelloWorld Program says:

<APPLET CODE="HelloWorld.class" WIDTH=600 HEIGHT=100>
</APPLET>

</BODY>
</HTML>
[/align]
[align=left]
import java.applet.*;
import java.awt.*;

public class HelloWorld extends Applet {
public void paint(Graphics g) {
g.drawString("Hello, World!", 100, 50);
}
}
[/align]

JavaFX Script (F3)

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

JavaScript

<script language="JavaScript">
document.write('Hello, World!');
</script>

or with an alert

[align=left]
alert('Hello, World!');
[/align]
or

[align=left]
<script type="text/javascript"><!--
function helloWorld()
{
alert("Hello, World!");
}
//--></script>
[/align]
[align=left]
<a href="#" onclick="helloWorld(); return false;">Hello World Example</a>
[/align]

[align=left]or [/align]
[align=left]
<a href="#" onclick="alert('Hello, World!'); return false;">Hello World Example
</a>
[/align]

K

K

[align=left]
`0:"Hello world/n"
[/align]

Kogut

[align=left]
WriteLine "Hello, World!"
[/align]

L

LaTeX

[align=left]
/documentclass{article}
/begin{document}
Hello, World!
/end{document}
[/align]

Lisaac

[align=left]
section HEADER
+ name := HELLO_WORLD;
- category := MACRO;
section INHERIT
- parent_object:OBJECT := OBJECT;
section PUBLIC
- make <-
(
"Hello World !/n".print;
);
[/align]

Lisp

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

Common Lisp

[align=left]
(format t "Hello World!~%")
[/align]
or

[align=left]
(write-line "Hello World!")
[/align]
or merely:

[align=left]
"Hello World!"
[/align]

Scheme

[align=left]
(display "Hello, World!")
[/align]

Emacs Lisp

[align=left]
(print "Hello, World!")
[/align]

AutoLisp

[align=left]
(print "Hello, World!")
[/align]

XLisp

[align=left]
(print "Hello, World!")
[/align]

Logo

[align=left]
print [Hello World!]
[/align]
or

[align=left]
pr [Hello World!]
[/align]

Lua

[align=left]
print "Hello, World!"
[/align]

M

M4

[align=left]
Hello, World!
[/align]

Macsyma, Maxima

[align=left]
print("Hello, World!")$
[/align]

Maple

[align=left]
>> print("Hello, World!");
[/align]

Mathematica

[align=left]
(* Hello World in Mathematica *)
Print["Hello world"]
[/align]

Matlab

[align=left]
disp('Hello world')
[/align]

Maude

[align=left]
fmod HELLOWORLD is
protecting STRING .
op helloworld : -> String .
eq helloworld = "Hello, World." .
endfm
red helloworld .
[/align]

Max

[align=left]
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;
[/align]

mIrc Script

[align=left]
echo Hello World
[/align]

Model 204

[align=left]
BEGIN
PRINT 'Hello, World!'END
[/align]

Modula-2

[align=left]
MODULE Hello;

FROM InOut IMPORT WriteLn, WriteString;

BEGIN
WriteString ("Hello, World!");
WriteLn
END Hello.
[/align]

Moo

[align=left]
notify(player, "Hello, World!");
[/align]

Ms-Dos batch

The @ symbol is optional and prevents the system from displaying the command before executing it.

[align=left]
@echo Hello, World!
[/align]

Muf

[align=left]
: main
me @ "Hello, World!" notify
;
[/align]

Mumps

[align=left]
W "Hello, World!"
[/align]

N

Natural

[align=left]
WRITE "Hello, World!"END
[/align]

Nemerle

[align=left]
System.Console.WriteLine("Hello, World!");
[/align]

NewtonScript

[align=left]
baseview :=
{viewBounds: {left: -3, top: 71, right: 138, bottom: 137},
viewFlags: 581,
declareSelf: 'base,
_proto: protoFloatNGo,
debug: "baseview"
};

textview := * child of baseview *
{text: "Hello World!",
viewBounds: {left: 33, top: 24, right: 113, bottom: 46},
viewFlags: 579,
_proto: protoStaticText,
debug: "textview"
};
[/align]

Nice

[align=left]
void main(String[] args)
{
println("hello world");
}
[/align]

O

Oberon

[align=left]
MODULE Hello;
IMPORT Out;
BEGIN
Out.String("Hello World!");
Out.Ln
END Hello.
[/align]

Objective C

Functional C Version

[align=left]
#import <stdio.h>

int main() {
printf( "Hello, World!/n" );
return 0;
}
[/align]

Object-Oriented C Version

[align=left]
#import <stdio.h>

//An object-oriented version.
@interface Hello : Object
{
const char str[] = "Hello world";
}
- (id) hello (void);
@end

@implementation Hello
- (id) hello (void)
{
printf("%s/n", str);
}
@end

int main(void)
{
Hello *h = [Hello new];
[h hello];

[h free];
return 0;
}
[/align]

OpenStep/Cocoa Version

[align=left]
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
NSLog(@"Hello, World!");
return 0;
}
[/align]

OCaml

[align=left]
print_endline"Hello World!"
[/align]

Occam

[align=left]
#USE "course.lib"

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

Octave

[align=left]
printf("Hello World/n");
[/align]

Opl

[align=left]
PROC hello:
PRINT "Hello, world"
ENDP
[/align]

Ops5

[align=left]
(object-class request
^action)

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

(rule hello
(request ^action hello)
(write |Hello World!| (crlf))
)
[/align]

Ops83

[align=left]
module hello (main)
{ procedure main( )
{
write() |Hello, World!|, '/n';
};
};
[/align]

Oz

[align=left]
{Browse 'Hello World!'}
[/align]

P

Parrot assembly language

[align=left]
print "Hello, World!/n"
end
[/align]

Pascal

[align=left]
program hello;

begin
writeln('Hello, World!');
end.
[/align]

Pdf

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

Perl

[align=left]
# Hello
print "Hello, World!/n";
[/align]

Perl 6

[align=left]
say "Hello world";
[/align]

PHP

[align=left]
<?php
echo 'Hello, World!';
?>
[/align]
or

[align=left]
<?php
print 'Hello, World!' . PHP_EOL;
?>
[/align]
or

[align=left]
<?='Hello, World!'?>
[/align]

Pike

[align=left]
int main() {
write("Hello, World!/n");
return 0;
}
[/align]

Pilot

[align=left]
T:Hello, World!
[/align]

Pl/Sql

[align=left]
-- start anonymous block
set serveroutput on size 10000000;
begin
dbms_output.enable(1000000);
dbms_output.put_line('Hello World!');
end;
-- end anonymous block
[/align]

Pl/I

[align=left]
Test: proc options(main) reorder;
put skip edit('Hello, World!') (a);
end Test;
[/align]

Pop-11

[align=left]
'Hello world' =>
[/align]

PostScript

[align=left]
% Displays on console.
(Hello World!) =

%!
% Displays as page output.
/Courier findfont
24 scalefont
setfont
100 100 moveto
(Hello World!) show
showpage
[/align]

Pov-Ray

[align=left]
#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 }
}
[/align]

Processing

[align=left]
println("Hello, World!");
[/align]

Profan

[align=left]
' Hello in Profan
cls
print"Hello World!"waitkey
[/align]

Progress

[align=left]
message "Hello World" view-as alert-box.
[/align]

Prolog

[align=left]
:- write('Hello world'),nl.
[/align]

Protocol Buffers

[align=left]
message hello
{
required string data = 1 [default="Hello World!"];
}
[/align]

PureBasic

[align=left]
; In PureBasic console
OpenConsole()
ConsoleTitle ("Hello World!")
PrintN ("Hello World!")
CloseConsole()
[/align]

Python

print "Hello, World!"

Q

Qt toolkit (C++)

#include<qapplication.h>
#include<qpushbutton.h>
#include<qwidget.h>
#include<iostream>

class HelloWorld : public QWidget
{
Q_OBJECT

public:
HelloWorld();
virtual ~HelloWorld();
public slots:
void handleButtonClicked();
QPushButton *mPushButton;
};

HelloWorld::HelloWorld() :
QWidget(),
mPushButton(new QPushButton("Hello, World!", this))
{
connect(mPushButton, SIGNAL(clicked()), this, SLOT(handleButtonClicked()));
}

HelloWorld::~HelloWorld() {}

void HelloWorld::handleButtonClicked()
{
std::cout << "Hello, World!" << std::endl;
}

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
HelloWorld helloWorld;
app.setMainWidget(&helloWorld);
helloWorld.show();
return app.exec();
}

or

 #include<QApplication>
#include<QPushButton>
#include<QVBoxLayout>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QWidget *window = new QWidget;
QVBoxLayout *layout = new QVBoxLayout(window);
QPushButton *hello = new QPushButton("Hello, World!", window);

//connect the button to quitting
hello->connect(hello, SIGNAL(clicked()), &app, SLOT(quit()));

layout->addWidget(hello);
layout->setMargin(10);
layout->setSpacing(10);

window->show();

return app.exec();
}

QuakeC

bprint("Hello World/n");

QuickBasic

REM Hello World in QuickBASIC
PRINT"Hello World!"END

R

R

cat("Hello world/n")

Ratfor

print *, 'hello, world'
end

RealBasic

' Hello
msgBox"Hello World!"

Rebol

print "Hello, World!"

Refal

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

Rexx, ARexx, NetRexx, and Object REXX

say "Hello, World!"

or, Windows:

call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
call RxMessageBox 'Hello World!', 'Hello World Window', 'OK', 'EXCLAMATION'
exit

Rpg

Free-Form Syntax

/FREE
DSPLY 'Hello, World!';
*InLR = *On;
/END-FREE

Traditional Syntax

d TestMessage
c Const( 'Hello, World!' )
c TestMessage DSPLY
c EVAL *InLR = *On

Rpg Code

Message Window

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

On Screen Text

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

RPL (HP calculators)

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

Rsl

[Hello World!];

Rtf

{/rtf1/ansi/deff0
{/fonttbl {/f0 Courier New;}}
/f0/fs20 Hello, World!}

Ruby

puts "Hello, World!"

S

S

cat("Hello world/n")

Sas

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

Sather

class HELLO_WORLD is
main is
#OUT+"Hello world/n";
end;
end;

Scala

object HelloWorld with Application {
Console.println("Hello, World!");}

Scriptol

print "Hello World!"

sed

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

Seed7

$ include "seed7_05.s7i";

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

Self

'Hello, World!' print.

Setl

-- Hello in Setl2

procedure Hello();
print "Hello World!";
end Hello;

Scheme

(display "Hello world!")
(newline)

Simula

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

Smalltalk

Transcript show: 'Hello, World!'; cr

Graphical:

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

Smil

<!-- Hello World in SMIL -->
<smil>
<head>
<layout>
<root-layout width="300" height="160" background-color="white"/>
<region id="text_region" left="115" top="60"/>
</layout>
</head>
<body>
<text src="data:,Hello%20World!" region="text_region">
<param name="fontFace" value="Arial"/>
</text>
</body>
</smil>

Sml

print "Hello, World!/n";

Snobol

OUTPUT = "Hello, World!"
END

Span

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

Spark

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

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

Spitbol

OUTPUT = "Hello, World!"
END

Spss Syntax

ECHO "Hello, World!".

Sql

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

MySQL or PostgreSQL:

SELECT 'Hello, World!';

Starlet

RACINE: HELLO_WORLD.
NOTIONS:
HELLO_WORLD : ecrire("Hello, World!").

SuperCollider

"Hello World".postln;

Svg

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg width="240" height="100" viewBox="0 0 240 100" zoomAndPan="disable"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Hello World</title>
<g>
<text x="10" y="50">Hello World</text>
<animate attributeName='opacity' values='0;1' dur='4s' fill='freeze' begin="0s"/>
</g>
</svg>

T

Tacl

?TACL HELLO
#OUTPUT Hello, World!

Tcl

puts "Hello, World!"

Teco

!Hello in TECO
FTHello World$


TeX

Hello world
/bye

Ti-Basic

10 REM Hello World in TI BASIC
20 REM for the TI99 series computer
100 CALL CLEAR
110 PRINT "HELLO WORLD"
120 GOTO 120

Tk

label .l -text"Hello World!"pack .l

Turing

put "Hello, World!"

U

Unix shell

echo 'Hello, World!'

or using an inline 'here document'

cat <<'DELIM'
Hello, World!DELIM

or

printf '%s' $'Hello, World!/n'

or for a curses interface:

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

UnrealScript

class HelloHUD extends HudBase;

simulated function DrawHudPassC (Canvas C)
{
C.SetPos( 0.50*C.ClipX , 0.50*C.ClipY);
C.DrawText("Hello World!");
}

defaultproperties
{
}

V

Verilog

module main;

initial
begin
$display("Hello, World");
$finish ;
end

endmodule

VHDL

use std.textio.all;

ENTITY hello IS
END ENTITY hello;

ARCHITECTURE Scriptol 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 Scriptol;

Visual Basic .Net 2003

If the code is entered as part of a Form subclass:

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

Traditional Visual Basic code:

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

Visual DialogScript

info Hello world!

Visual Prolog console program

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

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


W

Windows api (in C)

Old version:

#include<windows.h>

LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);

char szClassName[] = "MainWnd";

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wincl;

wincl.cbSize = sizeof(WNDCLASSEX);
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.style = 0;
wincl.hInstance = hInstance;
wincl.lpszClassName = szClassName;
wincl.lpszMenuName = NULL; //No menu
wincl.lpfnWndProc = WindowProcedure;
wincl.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); //Color of the window
wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION); //EXE icon
wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION); //Small program icon
wincl.hCursor = LoadCursor(NULL, IDC_ARROW); //Cursor

if (!RegisterClassEx(&wincl))
return 0;

hwnd = CreateWindowEx(0, //No extended window styles
szClassName, //Class name
"", //Window caption
WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX,
CW_USEDEFAULT, CW_USEDEFAULT, //Let Windows decide the left and top
//positions of the window
120, 50, //Width and height of the window,
NULL, NULL, hInstance, NULL);

//Make the window visible on the screen
ShowWindow(hwnd, nCmdShow);

//Run the message loop
while (GetMessage(&msg, NULL, 0, 0)>0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}

LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
TextOut(hdc, 15, 3, "Hello, World!", 13);
EndPaint(hwnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}

Or, much more simply:

#include<windows.h>
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, "Hello, World!", "", MB_OK);
return 0;
}

Vms

$ WRITE SYS$OUTPUT"Hello World!"

Vmrl

Shape
{
geometry Text
{string "Hello World!"}
}

Wscript

WScript.Echo("Hello World!");

X

X++

class classHello
{
}

static void main(args Args)
{
dialog dialog;
dialog = new dialog();
dialog.addText("Hello World!");
dialog.run();
}

XAML/WPF

<Page xmlns="http://schemas.microsoft.com/winfx/avalon/2005">
<TextBlock>Hello, World!</TextBlock>
</Page>

XHTML 1.1

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

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="HelloWorld.xsl" ?>
<!-- Hello in XML -->
<text>
<string>Hello, World!</string>
</text>

XQuery

(: Hello with XQuery :)
let $i :="Hello World!"return $i

XSLT

Simplest code:

<xsl:template match="/">
<xsl:text>Hello, World!</xsl:text>
</xsl:template>

Generate HTML:

<xsl:template match="/">
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
</xsl:template>

XUL

<?xml-stylesheet href="chrome://global/skin" type="text/css" ?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="center" pack="center" flex="1">
<description>Hello, World!</description>
</window>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: