几乎所有编程语言的hello, world程序(2)
D
// Hello World in D
import std.stdio;
void main()
{
writefln("Hello World!");
}
D4
// Hello World as a relation-variable in D4
select row { "Hello World" AMessage }
Darkbasic
` Hello World in Darkbasic
print "Hello World!"
wait key
Dart
// Hello world in Dart
main() {
print('Hello world!');
}
Databasic
PROGRAM HELLO.B
# Hello World in Databasic
CRT "HELLOW WORLD"
END
Dataflex
// Hello World in Dataflex Procedural
/tela
Hello world
/*
clearscreen
page tela
dBase
* Hello World in dBase IV
? "Hello World!"
dc
#!/usr/bin/dc
# Hello world! in dc (Unix desk calculator)
[Hello world!]p
DCL
$! Hello world in Digital/Compaq/HP DCL (Digital Command Language)
$ write sys$output "Hello World"
Delphi
// Hello World in Delphi
Program Hello_World;
{$APPTYPE CONSOLE}
Begin
WriteLn('Hello World');
End.
Dialect
# Hello World in Dialect
print "Hello World"
DM
// Hello World in DM (Dream Maker)
mob
Login()
..()
world << "Hello World!"
DML
! Hello World in DML (Gembase database language)
PROCEDURE_FORM MAIN
PRINT/NOWAIT ("Hello world")
END_FORM
Draco
/* Hello world in Draco */
proc main()void:
writeln("Hello world!");
corp;
DWIM
Hello World in DWIM ("Do what I mean"). Comments are not needed in this language.
DWIM
Dylan
module: hello-world
author: Homer
copyright: (c) 1994 Homer
version: 1.0
// Hello World in DYLAN
define method main (#rest args)
princ("Hello world!");
end;
main();
DynaMorph
<<!! Hello World in DynaMorph >>
<#setString foo {Hello World!}#>
<html>
<head>
<title>DynaMorph</title>
</head>
<body>
<#getString foo#>
</body>
</html>
E
# Hello World in E
println("Hello, world!")
easm
// Hello World in easm (Win32).
subsystem cui
section imports
from msvcr70.dll import printf
from kernel32.dll import ExitProcess
section data
string pszOutput = "Hello World!"
section code
call printf (&pszOutput)
call ExitProcess (00h)
Ecstatic
Hello world in Ecstatic. No comments are possible in this language.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(followed by another 24,866,256,684,781,338,733,321,022,194,929,619,017,923,951,399,467,222,375,071,721,694,990,877,932,162,871,254,860,704 exclamation points)
Eiffel
note "Hello World in Eiffel"
class HELLO
create run
feature run
do
print ("Hello World!%N")
end
end
Elan
(* Hello World in ELAN *)
putline ("Hello World!");
Elixir
# Hello world in Elixir
defmodule HelloWorld do
IO.puts "Hello, World!"
end
Elliott
:: Hello World in Elliott Autocode
SETF PUNCH
SETR 1
1)TELEPRINTER
LINE
TITLE Hello World.;
STOP
START 1
Elm
-- Hello world in Elm
import Text
main = Text.plainText "Hello, world!"
Emoticon
** Hello world in Emoticon **
hello world :-Q S:-P :-Q
Erlang
%% Hello World in Erlang
-module(hello).
-export([hello/0]).
hello() ->
io:format("Hello World!~n", []).
ERRE
! Hello world in ERRE
PROGRAM HELLO
BEGIN
PRINT("Hello World!")
END PROGRAM
Euphoria
-- Hello World in Euphoria
puts(1, "Hello World!\n")
FSharp
(* Hello World in F# *)
printf "Hello World!\n"
F
! Hello world in F
program hello
print *, "Hello world!"
end program hello
Falcon
// Hello World in Falcon
> "Hello World!"
FALSE
{ Hello World in FALSE }
"Hello world!"
Ferite
/**
* start script -- Hello world in Ferite ( www.ferite.org )
*/
uses "console";
Console.println("Hello World");
/* end script */
Filemaker
#Hello World in Filemaker Script
Show Custom Dialog ["Hello World" ; "Hello World"]
Fjölnir
;; Hello World in Fjölnir (Icelandic programming language)
"hello" < main
{
main ->
stef(;)
stofn
skrifastreng(;"Halló Veröld!"),
stofnlok
}
*
"GRUNNUR"
;
Flaming Thunder
# Write "Hello world" in Flaming Thunder.
Write "Hello world".
Focal
1.01 COMMENT HELLO WORLD IN FOCAL
1.02 TYPE "HELLO WORLD", !
1.03 QUIT
FOCUS
-* Hello World in FOCUS
-TYPE Hello world
Forth
' Hello world in Forth
." Hello World" CR
Fortran
Hello World in Fortran
PROGRAM HELLO
WRITE (*,100)
STOP
100 FORMAT (' Hello World! ' /)
END
Fortran77
C Hello World in Fortran 77
PROGRAM HELLO
PRINT*, 'Hello World!'
END
Fortran90
! Hello World in Fortran 90 and 95
PROGRAM HelloWorld
WRITE(*,*) "Hello World!"
END PROGRAM
FortranIV
PROGRAM HELLO
c
C Hello World in Fortran IV (supposedly for a TR440)
c
WRITE (6,'('' Hello World!'')')
END
Fortress
(* Hello World in Fortress *)
export Executable
run(args) = print "Hello, world!"
FreeBASIC
'Hello World in FreeBASIC
print "Hello World"
Frink
// Hello World in Frink
println["Hello World!"]
G-code
Hello World in G-code. Click here for a preview.
%
O1000
(PROGRAM NAME - HELLOWORLD)
(DATE=DD-MM-YY - 30-06-05 TIME=HH:MM - 19:37)
N10G20
N20G0G17G40G49G80G90
/N30G91G28Z0.
/N40G28X0.Y0.
/N50G92X0.Y0.Z0.
( 1/16 FLAT ENDMILL TOOL - 1 DIA. OFF. - 1 LEN. - 1 DIA. - .0625)
(CONTOUR)
N60T1M6
N70G0G90X0.Y1.A0.S5000M3
N80G43H1Z.5
N90Z.25
N100G1Z-.005F2.
N110Y0.F20.
N120G0Z.5
N130X.5
N140Z.25
N150G1Z-.005F2.
N160Y1.F20.
N170G0Z.5
N180Y.6106
N190Z.25
N200G1Z-.005F2.
N210X0.F20.
N220G0Z.5
N230X.6157Y.4712
N240Z.25
N250G1Z-.005F2.
N260X.6039Y.4135F20.
N270X.6Y.351
N280X1.1
N290G3X1.0098Y.6202R.4333
N300X.8941Y.6971R.2625
N310X.7255Y.6538R.1837
N320X.6157Y.4712R.332
N330G0Z.5
N340X.6Y.351
N350Z.25
N360G1Z-.005F2.
N370X.6039Y.2885F20.
N380G3X.7255Y.0481R.385
N390X.9745R.1853
N400X1.0843Y.2308R.332
N410G0Z.5
N420X1.2039Y0.
N430Z.25
N440G1Z-.005F2.
N450Y1.F20.
N460G0Z.5
N470X1.3098
N480Z.25
N490G1Z-.005F2.
N500Y0.F20.
N510G0Z.5
N520X1.4706Y.125
N530Z.25
N540G1Z-.005F2.
N550X1.502Y.0817F20.
N560G3X1.6176Y.0048R.2625
N570X1.7863Y.0481R.1837
N580X1.9118Y.351R.3957
N590X1.8216Y.6202R.4333
N600X1.7059Y.6971R.2625
N610X1.5373Y.6538R.1837
N620X1.4157Y.4135R.358
N630X1.4706Y.125R.4611
N640G0Z.5
N650X1.9853Y0.
N660Z.25
N670G1Z-.005F2.
N680X2.0422Y.1442F20.
N690G0Z.5
N700X2.5706Y1.
N710Z.25
N720G1Z-.005F2.
N730X2.6961Y0.F20.
N740X2.8216Y1.
N750X2.9451Y0.
N760X3.0706Y1.
N770G0Z.5
N780X3.2961Y.6538
N790Z.25
N800G1Z-.005F2.
N810X3.2608Y.6202F20.
N820G3X3.1745Y.2885R.4408
N830X3.2961Y.0481R.385
N840X3.5451R.1853
N850X3.6706Y.351R.3957
N860X3.5804Y.6202R.4333
N870X3.4647Y.6971R.2625
N880X3.2961Y.6538R.1837
N890G0Z.5
N900X3.7461Y.7019
N910Z.25
N920G1Z-.005F2.
N930Y0.F20.
N940G0Z.5
N950Y.3654
N960Z.25
N970G1Z-.005F2.
N980X3.7637Y.4663F20.
N990G2X3.8422Y.6587R.4948
N1000X3.9167Y.7019R.0929
N1010G1X4.0755
N1020G2X4.15Y.6587R.0929
N1030X4.1951Y.5769R.246
N1040G0Z.5
N1050X4.3255Y1.
N1060Z.25
N1070G1Z-.005F2.
N1080Y0.F20.
N1090G0Z.5
N1100X4.9275
N1110Z.25
N1120G1Z-.005F2.
N1130Y1.F20.
N1140G0Z.5
N1150X5.0314
N1160Z.25
N1170G1Z-.005F2.
N1180Y.2981F20.
N1190G0Z.5
N1200X4.9275Y.274
N1210Z.25
N1220G1Z-.005F2.
N1230X4.8941Y.1731F20.
N1240G2X4.7627Y.0192R.3255
N1250X4.5529Y.0481R.1862
N1260X4.4314Y.2885R.358
N1270X4.5176Y.6202R.4408
N1280X4.6333Y.6971R.2625
N1290X4.802Y.6538R.1837
N1300X4.8941Y.5288R.3457
N1310G1X4.9275Y.4279
N1320G0Z.5
N1330X5.0314Y.149
N1340Z.25
N1350G1Z-.005F2.
N1360Y0.F20.
N1370G0Z.5
N1380M5
N1390G91G28Z0.
N1400G28X0.Y0.A0.
N1410M30
%
Gambas
Back to index
'************************************
' Hello world in Gambas
'************************************
PUBLIC SUB Main()
PRINT "Hello World"
END
GameMonkey Script
// Hello World in GameMonkey Script
print("Hello World");
Gentee-simple
// Hello World in Gentee (simple version)
func hello<main> : @"Hello, World!"
Gentee
// Hello World in Gentee
func hello <main>
{
print( "Hello, World!" )
getch()
}
GLBasic
// Hello World in GLBasic
PRINT "Hello World",1,1
SHOWSCREEN
MOUSEWAIT
GML
// Hello World in GML (Game Maker Language)
draw_text(10,10,"Hello World")
screen_refresh()
keyboard_wait()
Go
// Hello world in Go
package main
import "fmt"
func main() {
fmt.Printf("Hello World\n")
}
Gofer
-- Hello World in Gofer
-- Simple version
helloWorld:: String
helloWorld = "Hello World!\n"
-- Hello World in Gofer
-- Dialog version
helloWorld :: Dialogue
helloWorld resps = [AppendChan stdout "Hello world!"]
GoogleGadgets
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Hello World as a Google gadget -->
<Module>
<ModulePrefs title="hello world example" />
<Content type="html">
<![CDATA[
Hello, world!
]]>
</Content>
</Module>
GRAMophone
//Hello World in GRAMophone
composition "Hello, World!" of "Composer"
{
%
player player1 {
grammar lindenmayer
%
axiom->print("Hello, World!");
}
player player2 {
grammar chomsky
%
@composition->print("Hello, World!");
}
}
Gri
# Hello World in Gri
show "hello world"
Groovy
// Hello World in Groovy
println "Hello World"
Guile
; Hello world in Guile
(define do-hello (lambda () (display "Hello world.") (newline)))
GynkoSoft
; Hello World in GynkoSoft
; Simple version
0.00 Protocol "Hello, World!"
; Hello World in GynkoSoft
; Dialog box output
0.00 Message "Hello, World!"
Haskell
-- Hello World in Haskell
main = putStrLn "Hello World"
Haxe
// Hello world in Haxe
class Hello {
static public function main() {
trace("Hello world!");
}
}
HDX
# Hello World as bdehaldia.exe external command
proc hdx_info {} {
set ::Titel [TRA "&Hello World"]
set ::Menu GMA
}
proc hdx_run {} {
tk_messageBox -type ok -message [TRA "Hello World!"]
destroy .
}
HyperTalk
-- Hello World in HyperTalk
answer "Hello, world!"
IBM-Exec
Hello World for IBM EXEC (under VM/CMS)
&CONTROL
*
&TYPE Hello World!
*
&EXIT 0
IBM-Exec2
Hello World for IBM EXEC2 (under VM/CMS)
&TRACE OFF
*
&TYPE Hello World!
*
&EXIT 0
ici
# Hello World in ici
printf("Hello World!\n");
ICL SCL
@ HELLO WORLD IN ICL SCL
BEGIN
SEND_MESSAGE("HELLO WORLD")
END
Icon
# Hello world in Icon (http://www.cs.arizona.edu/icon/)
procedure main()
write("Hello world")
end
IDC
// Hello World in IDC-script language for IDA disaasembler
#include <idc.idc>
static main(void)
{
Message("Hello World!");
}
IDL
IDL> ; Hello World in IDL (Interactive Data Language)
IDL> print, "Hello World"
Idris
Hello world in Idris
> main : IO ()
> main = putStrLn "Hello, World!"
Inform
! "Hello world" in Inform
[ Main;
print "Hello world^";
];
Informix-4GL
# Hello World in Informix 4GL
MAIN
DISPLAY "Hello World"
END MAIN
Ingres-ABF
/* Hello World in Ingres ABF */
procedure hello =
begin
message 'Hello, World' with style=popup;
end
InstallScript
// Hello World in InstallScript
// (Scripting language of InstallShield, a Windows install generator)
program
MessageBox("Hello World!",INFORMATION);
endprogram
Intercal
Hello World in Intercal
DO ,1 <- #13
PLEASE DO ,1 SUB #1 <- #234
DO ,1 SUB #2 <- #112
DO ,1 SUB #3 <- #112
DO ,1 SUB #4 <- #0
DO ,1 SUB #5 <- #64
DO ,1 SUB #6 <- #194
DO ,1 SUB #7 <- #48
PLEASE DO ,1 SUB #8 <- #22
DO ,1 SUB #9 <- #248
DO ,1 SUB #10 <- #168
DO ,1 SUB #11 <- #24
DO ,1 SUB #12 <- #16
DO ,1 SUB #13 <- #214
PLEASE READ OUT ,1
PLEASE GIVE UP
Io
// Hello World in io programming language
"Hello world!" print
Iptscrae
; Hello World in Iptscrae.
; 1. from the chat prompt:
/ "Hello World!" SAY
; 2. in a cyborg:
ON OUTCHAT {
{ "Hello World!" SAY
} CHATSTR "say it" == IF
}
; 3. in a room script:
ON SELECT {
"Hello World!" SAY
}
J
Back to index
NB. Hello World in J
'Hello World' 1!:2(2)
Jade
// Hello World in JADE
write "Hello World";
Jako
# Hello World in Jako
use sys;
sys::print("Hello, world!\n");
Jason
// Hello World in Jason
!greeting.
+!greeting : true <- .print("Hello World").
Java
Back to index
// Hello World in Java
class HelloWorld {
static public void main( String args[] ) {
System.out.println( “Hello World!” );
}
}
Java-Mobile
// Hello World on a mobile Java device
package helloworld;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloWorld extends MIDlet {
public HelloWorld()
{
Form form = new Form("Hello World");
form.append("Hello world!");
Display.getDisplay(this).setCurrent(form);
}
protected void pauseApp() { }
protected void startApp() throws
javax.microedition.midlet.MIDletStateChangeException { }
protected void destroyApp(boolean parm1) throws
javax.microedition.midlet.MIDletStateChangeException { }
}
Java-Server-Pages
<!-- Hello World for Java Server Pages -->
<%@ page language='java' %>
<%="Hello World!" %>
Java-Servlet
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
//
// Hello World Java Servlet
//
public class HelloWorld extends HttpServlet {
public void service(HttpServletRequest request,
HttpServletResponse response)
throws IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("Hello World!");
out.println("</body></html>");
}
}
Java-Swing
// Hello World in Java using Swing GUI
class HelloWorldSwing {
static public void main(String args[]) {
javax.swing.JOptionPane.showMessageDialog(null,"Hello world!");
}
}
JavaScript
<html>
<body>
<script language="JavaScript" type="text/javascript">
// Hello World in JavaScript
document.write('Hello World');
</script>
</body>
</html>
JCL
//HERIB JOB ,'HERIBERT OTTEN',PRTY=12
//* HELLO WORLD FOR MVS
//HALLO EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=T
//SYSUT1 DD *
HELLO WORLD!
/*
//
Jess
; Hello World in JESS
(printout t "Hello World")
JudoScript
// Hello World in JudoScript (a Java scripting layer)
. "Hello World";
K
/ Hello world in K
"Hello world!"
K3
/ Hello World in K3
`0:"Hello World!\n
K4
/ Hello World in K4/Q/KDB
1"Hello World\n"
K5
/ Hello World in K5
1'"Hello World\n"
Kix
; Hello World in Kix
Run( "Notepad.exe" )
Sleep 1
SetFocus( "Untitled - Notepad" )
$ReturnCode = SendKeys("Hello World")
Sleep( 2 )
$ReturnCode = SendKeys("~{F4}Y")
Kylix
{Hello World in Kylix}
program Hello_World;
uses
QDialogs;
begin
ShowMessage('Hello World');
end.
L
// Hello World in L
namespace Hello is
class Main is
void init is()
IO.Std.out.println("Hello World!");
end
end
end
LabVIEW
LaTeX
Back to index
% Hello World! in LaTeX
\documentclass{article}
\begin{document}
Hello World!
\end{document}
LibertyBASIC
'hello world in Liberty BASIC
PRINT "Hello World"
END
LilyPond
% Hello World in LilyPond
\markup { Hello World! }
Limbo
Hello World in Limbo.
Limbo is the programming language of the Inferno OS
(from Lucent Bell Labs).
implement Cmd;
include "sys.m";
include "draw.m";
Cmd : module {
init : fn (ctxt : ref Draw->Context, args : list of string);
};
init(nil : ref Draw->Context, nil : list of string)
{
sys := load Sys Sys->PATH;
sys->print("Hello World\n");
}
LIMS-Basic
'Hello World in LIMS Basic
msgbox("hello world")
Lingo
Hello World in Lingo (Macromedia Director)
on startmovie
alert "Hello World"
end
Linotte
(Hello World in Linotte)
Livre : Hello
Paragraphe : display message
Actions :
Affiche "Hello World!"
Termine
Lisaac
// Hello World in Lisaac
Section Header
+ name := HELLO_WORLD;
Section Inherit
- parent_object:OBJECT := OBJECT;
Section Public
- main <-
(
"Hello world !\n".print;
);
Lisp-Emacs
;;; Hello World in Emacs Lisp.
(defun hello-world()
"Display the string hello world."
(interactive)
(message "hello world"))
Logo
; Hello World in Logo
DRUCKEZEILE [Hello World!]
Logo-graphical
; Hello World in LOGO, graphical output.
go 20 , left 180,
go 40 , left 180,
go 20 , right 90,
go 20 , left 90 ,
go 20 , left 180,
go 40 , left 90 ,
go 20 , left 90 ,
go 20 , right 90 ,
go 20 , right 90 ,
go 10 , right 90 ,
go 20 , left 90 ,
go 10 , left 90 ,
go 30 , left 90 ,
go 40 , left 180,
go 40 , left 90 ,
go 20 , left 90 ,
go 40 , left 180,
go 40 , left 90 ,
go 40 , left 90 ,
go 20 , left 90 ,
go 20 , left 90 ,
go 20 , left 90 ,
go 60 , left 90 ,
go 40 , left 180,
go 40 , left 90 ,
go 20 , left 90 ,
go 20 , left 180,
go 20 , left 90 ,
go 20 , left 90 ,
go 40 , left 180,
go 40 , left 90 ,
go 40 , left 90 ,
go 20 , left 90 ,
go 20 , left 90 ,
go 20 , left 90 ,
go 40 , left 90 ,
go 20 , right 90,
go 20 , right 90,
go 5 , left 90 ,
go 5 , left 90 ,
go 25 , left 180,
go 40 , left 90 ,
go 40 , left 90 ,
go 20 , left 90 ,
go 20 , left 90 ,
go 20 , left 90 ,
go 20 , left 90 ,
go 40 , left 180,
go 40 ,
LOLCODE
BTW Hello World in LOLCODE
HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
LOTOS
(* Hello World in LOTOS (Language Of Temporal Ordering Specifications) *)
process HelloWorld [v]: exit :=
v! "Hello World!";
exit
endproc
Lotus-Note-Formula
REM "Lotus Note Formula Language";
@Prompt([ok];"Hi there";"Hello World");
Lotus-Script
' Hello World in Lotus Script
Sub Initialize
Msgbox "Hello world", 0, "Hi there!"
End Sub
LPC
// Hello World in LPC
void create()
{
message("info","Hello World!",this_user());
}
LS-DYNA
$ "Hello World" for LS-DYNA
*KEYWORD
*PART
1 1 1
*SECTION_BEAM
1 1 1.0 2 1
1.0 1.0 0.0 0.0 1 1
*MAT_ELASTIC
1 1.0E-9 1000.0 0.3
*ELEMENT_BEAM
1 1 2 3 1
2 1 3 4 1
3 1 3 6 1
4 1 6 5 1
5 1 8 11 1
6 1 11 12 1
7 1 12 9 1
8 1 9 8 1
9 1 8 7 1
10 1 7 10 1
11 1 14 16 1
12 1 16 15 1
13 1 13 15 1
14 1 15 17 1
15 1 19 21 1
16 1 21 20 1
17 1 18 20 1
18 1 20 22 1
19 1 23 24 1
20 1 24 26 1
21 1 26 25 1
22 1 25 23 1
23 1 27 28 1
24 1 28 29 1
25 1 29 30 1
26 1 30 31 1
27 1 32 33 1
28 1 33 35 1
29 1 35 34 1
30 1 34 32 1
31 1 36 37 1
32 1 37 38 1
33 1 40 42 1
34 1 42 41 1
35 1 39 41 1
36 1 41 43 1
37 1 44 45 1
38 1 45 47 1
39 1 48 47 1
40 1 47 46 1
41 1 46 44 1
*NODE
1 0.0 0.0 1.0
2
3 0.0 2.0
4 0.0 4.0
5 2.0
6 2.0 2.0
7 3.0
8 3.0 1.0
9 3.0 2.0
10 5.0
11 5.0 1.0
12 5.0 2.0
13 6.0
14 6.0 4.0
15 7.0
16 7.0 4.0
17 8.0
18 9.0
19 9.0 4.0
20 10.0
21 10.0 4.0
22 11.0
23 12.0
24 12.0 2.0
25 14.0
26 14.0 2.0
27 16.0 2.0
28 16.5
29 17.0 1.0
30 17.5
31 18.0 2.0
32 19.0
33 19.0 2.0
34 21.0
35 21.0 2.0
36 22.0
37 22.0 2.0
38 24.0 2.0
39 25.0
40 25.0 4.0
41 26.0
42 26.0 4.0
43 27.0
44 28.0
45 28.0 2.0
46 30.0
47 30.0 2.0
48 30.0 4.0
*END