List of hello world programs / high level programming languages
This is a list of hello world programs for common high level programming languages . For each language it is demonstrated how to solve the simple task of putting the text “Hello world!” On the screen. Further examples of graphical user interfaces, web technologies, exotic programming languages and markup languages are given under List of Hello World Programs / Other ; Examples in assembler for different platforms can be found under List of Hello World Programs / Assembler . The shortest Hello World program is provided by the programming language APL , the second shortest is Forth . Both do without a function or keyword.
ABAP
REPORT Z_HALLO_WELT.
WRITE 'Hallo Welt!'.
ActionScript
trace('Hallo Welt');
ActionScript 3.0 and using the DocumentClass:
package {
import flash.display.Sprite;
public class Main extends Sprite {
public function Main() {
trace( "Hallo Welt!" );
}
}
}
Ada
with Ada.Text_IO;
procedure Hallo is
begin
Ada.Text_IO.Put_Line ("Hallo Welt!");
end Hallo;
For an explanation of the program see Ada Programming / Basic in the English-language Wikibooks .
Algol 60
'BEGIN'
OUTSTRING(2,'('HALLO WELT')');
'END'
Note: In the language definition of ALGOL 60, the input / output instructions were expressly excluded from the standardization, so that their implementations vary greatly between the compilers. With the Electrologica X1 this text is output SELECTOUTPUT(2);
with WRITETEXT('('HALLO WELT')');
instead of with the OUTSTRING command (after selecting the output channel with beforehand ) .
Algol 68
( print("Hallo Welt!") )
AMOS BASIC
? "Hallo Welt!"
APL
'Hallo Welt!'
AppleScript
display dialog "Hallo Welt!"
ASP (Active Server Pages)
<%
Response.Write("Hallo Welt!")
%>
or shortened
<%="Hallo Welt!"%>
AutoHotkey
Variant 1: a classic message box
MsgBox Hallo Welt!
Variant 2: Start the Notepad program and type in "Hello World"
Run, "notepad.exe"
WinWaitActive, ahk_class Notepad
Send, Hallo Welt{!}
AutoIt
Variant 1: Starts a normal message box without a title
MsgBox(0, "", "Hallo Welt!")
Variant 2: Start the editor, wait until it is active, keep the window active while the send command is being executed and write Hello World! inside.
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
SendKeepActive("[CLASS:Notepad]")
Send("Hallo Welt!",1)
AutoLISP
(princ "Hallo Welt!")
awk
BEGIN { print "Hallo Welt!" }
B.
main() {
printf("Hallo Welt!");
}
BASIC
Traditional, unstructured BASIC:
10 PRINT "Hallo Welt!"
or in direct mode:
?"Hallo Welt!"
Batch
The command line language of MS-DOS , PC DOS , DR-DOS and Windows NT .
@echo Hallo Welt!
BeanShell
print("Hallo Welt!");
Blitz Basic
Without GUI :
Print "Hallo Welt"
WaitKey
End
With GUI (BlitzPlus)
window = CreateWindow("Hallo Welt! Fenster", 0, 0, 100, 80, 0, 1)
label = CreateLabel("Hallo Welt!", 5, 5, 80, 20, window)
Repeat
Until WaitEvent() = $803
BlitzMax
Framework BRL.StandardIO
Print("Hallo Welt!")
Boo
print "Hallo Welt!"
C.
#include <stdio.h>
int main() {
puts("Hallo Welt!");
return 0;
}
C using the POSIX API
#include <unistd.h>
const char HALLOWELT[] = "Hallo Welt!\n";
int main(void)
{
write(STDOUT_FILENO, HALLOWELT, sizeof HALLOWELT - 1);
return 0;
}
C with GTK
#include <gtk/gtk.h>
gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{
return FALSE;
}
void destroy(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
void clicked(GtkWidget *widget, gpointer data)
{
g_print("Hallo Welt!\n");
}
int main (int argc, char *argv[])
{
gtk_init(&argc, &argv);
GtkWidget *window;
GtkWidget *button;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width(GTK_CONTAINER(window), 10);
g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(delete_event), NULL);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL);
button = gtk_button_new_with_label("Hallo Welt!");
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(clicked), NULL);
gtk_widget_show(button);
gtk_container_add(GTK_CONTAINER(window), button);
gtk_widget_show(window);
gtk_main();
}
C with Windows API
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(0, "Hallo Welt!", "Mein erstes Programm", MB_OK);
return 0;
}
C ++
#include <iostream>
int main()
{
std::cout << "Hallo Welt!" << std::endl;
}
C ++ / CLI
int main()
{
System::Console::WriteLine("Hallo Welt!");
}
C ++ / CX
#include "stdafx.h"
#using <Platform.winmd>
using namespace Platform;
[MTAThread]
int main(Array<String^>^ args)
{
String^ message("Hallo Welt!");
Details::Console::WriteLine(message);
}
C ++ with gtkmm
#include <gtkmm/main.h>
#include <gtkmm/button.h>
#include <gtkmm/window.h>
int main (int argc, char* argv[])
{
Gtk::Main m_main(argc, argv);
Gtk::Window m_window;
Gtk::Button m_button("Hallo Welt!");
m_window.add(m_button);
m_button.show();
Gtk::Main::run(m_window);
}
C ++ with Qt
#include <QLabel>
#include <QApplication>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QLabel label("Hallo Welt!");
label.show();
app.exec();
}
C #
class MainClass
{
public static void Main()
{
System.Console.WriteLine("Hallo Welt!");
}
}
or as a message box
static class Program
{
static void Main()
{
System.Windows.Forms.MessageBox.Show("Hallo Welt");
}
}
C / AL
MESSAGE('Hallo Welt')
Ceylon
// In der Datei module.ceylon
module hello "1.0.0" {}
// In der Datei hallo.ceylon
shared void run() {
print("Hallo Welt!");
}
CIL
.assembly HalloWelt { }
.assembly extern mscorlib { }
.method public static void Main() cil managed
{
.entrypoint
.maxstack 1
ldstr "Hallo Welt!"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
CLIST
WRITE HALLO WELT
Clojure
(println "Hallo Welt!")
CLP
PGM
SNDPGMMSG MSG('Hallo Welt!') MSGTYPE(*COMP)
ENDPGM
COBOL
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLOWORLD.
000900 PROCEDURE DIVISION.
001000 MAIN.
001100 DISPLAY "Hallo Welt!".
001200 STOP RUN.
COLDFUSION
<cfset beispiel = "Hallo Welt!" >
<cfoutput>#beispiel#</cfoutput>
COMAL
10 PRINT "Hallo Welt!"
Common Lisp
(write-line "Hallo Welt!")
Component Pascal
MODULE HalloWelt;
IMPORT Out;
PROCEDURE Output*;
BEGIN
Out.String ("Hallo Welt!");
Out.Ln;
END Output;
END HalloWelt.
D.
import std.stdio;
void main() {
writeln("Hallo Welt!");
}
DarkBASIC
print "Hallo Welt!"
wait key
dBASE / Foxpro // Clipper
Output in the next free line:
? "Hallo Welt!"
Line and column exact output:
@1,1 say "Hallo Welt!"
Output in a window:
wait window "Hallo Welt!"
Dylan
define method hallo-welt()
format-out("Hallo Welt!\n");
end method hallo-welt;
hallo-welt();
Eiffel
class HALLO_WELT
create
make
feature
make is
do
io.put_string("Hallo Welt!%N")
end
end
ELAN
putline ("Hallo Welt!");
Elixir
IO.puts "Hello World"
or:
defmodule HelloWorld do
def hello() do
IO.puts "Hello World!"
end
end
Emacs Lisp ( Elisp )
(print "Hallo Welt!")
;; Ausgabe auf verschiedenen Wegen:
(print "Hallo Welt!" t) ; Ausgabe im Minibuffer (Meldungsbereich), Voreinstellung
; (also das gleiche wie der erste Aufruf)
(message "Hallo, Welt!") ; auch das gleiche wie der erste Aufruf
(print "Hallo Welt!" BUFFER) ; Einfügen in BUFFER bei "point" (= aktuelle Cursorposition)
; Ein "buffer" ist normalerweise eine zum Bearbeiten geöffnete
; (oft noch nicht gespeicherte) Datei.
(print "Hallo Welt!" ; Einfügen in ...
(current-buffer)) ; ... den aktuellen "buffer", bei "point"
(insert "Hallo Welt!") ; das gleiche
(print "Hallo Welt!" MARKER) ; Einfügen in den aktuellen "buffer" bei MARKER
; (ein Marker ist eine vom Benutzer gespeicherte Position)
(print ...)
accepts even more exotic possibilities than BUFFER or MARKER, but which lead too far away from a simple output and are therefore not listed here.
None of the options listed above write to STDOUT or STDERR, because Elisp is executed within Emacs, which in typical use is not a command-line-oriented program, but inward-oriented
. The variants listed at the beginning, which normally write to the minibuffer, write to STDERR instead if you start Emacs non-interactively (option --batch
) on the command line:
> emacs -Q --batch --eval='(print "Hallo, Welt!")'
Hallo, Welt!
> emacs -Q --batch --eval='(print "Hallo, Welt!" t)'
Hallo, Welt!
> emacs -Q --batch --eval='(message "Hallo, Welt!")'
Hallo, Welt!
There is probably no possibility of outputting to STDOUT.
Erlang
-module(hallo).
-export([hallo_welt/0]).
hallo_welt() -> io:fwrite("Hallo Welt!\n").
F #
printfn "Hallo Welt"
Forth
As a word:
: hallo-welt
." Hallo, Welt!" cr
;
or in direct mode:
.( Hallo, Welt!) cr
Fortran
program hallo
write(*,*) "Hallo Welt!"
end program hallo
Fortress
component HalloWelt
export Executable
run(args:String) = print "Hallo Welt!"
end
FreeBASIC
print "Hallo Welt!"
sleep
GML
show_message("Hallo Welt!");
or:
draw_text(x,y,"Hallo Welt!");
Gambas
PUBLIC SUB Form_Enter()
PRINT "Hallo Welt!"
END
Go
package main
import "fmt"
func main() {
fmt.Println("Hallo Welt!")
}
Groovy
println "Hallo Welt!"
Haskell
main :: IO ()
main = putStrLn "Hallo Welt!"
Knuckle
class Test {
static function main() {
trace("Hallo Welt!");
}
}
The SWF or Neko byte codes compiled from them can run alone. Additionally required to use compiled JavaScript:
<html><body>
<div id=“haxe:trace“></div>
<script type=“text/javascript“ src=“hallo_welt_haxe.js“></script>
</body></html>
IDL (RSI)
PRO hallo_welt
PRINT, "Hallo Welt!"
END
Io
"Hallo Welt!" print
J #
public class HalloWelt
{
public static void main(String[] args)
{
System.Console.WriteLine("Hallo Welt!");
}
}
JavaScript
In the browser
document.write("Hallo Welt!");
With Node.js
console.log("Hallo Welt!");
Java
class Hallo {
public static void main( String[] args ) {
System.out.print("Hallo Welt!");
}
}
or as a dialog window:
import javax.swing.*;
class Hallo {
public static void main( String[] args ) {
JOptionPane.showMessageDialog( null, "Hallo Welt!" );
}
}
Java applet
Java applets work in conjunction with HTML .
The Java file:
import java.applet.*;
import java.awt.*;
public class HalloWelt extends Applet {
public void paint(Graphics g) {
g.drawString("Hallo Welt!", 100, 50);
}
}
The following is the code for incorporation into an HTML page. Recommended by the W3C :
<object classid="java:HalloWelt.class"
codetype="application/java-vm"
width="600" height="100">
</object>
For compatibility with very old browsers (not recommended):
<applet code="HalloWelt.class"
width="600" height="100">
</applet>
Java JDBC
JDBC programs work in conjunction with a database, for which the manufacturer must provide a suitable database driver.
The Java file:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Main
{
private static final String URL = "jdbc:mysql://localhost/TEST?useSSL=false";
private static final String USER = "root";
private static final String PASSWORD = "password";
//
private static final String SQL = "SELECT 'Hello, World!' ";
public static void main( String[] args ) throws SQLException {
Connection conn = DriverManager.getConnection( URL, USER, PASSWORD );
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery( SQL );
while ( rs.next() ) {
System.out.println( rs.getString( 1 ) );
}
}
}
The example uses a MySQL database called TEST on the current computer (localhost). A user named "root" with the password "password" must be created. A database driver is com.mysql.jdbc.Driver
used that mysql-connector-java-5.1.38-bin.jar
is available in the archive . The archive can be downloaded from dev.mysql.com. When executing the program, the archive file is specified Classpath
in.
Julia
println("Hallo Welt!")
KiXtart
? "Hallo Welt!"
Kotlin
fun main(args: Array<String>) {
println("Hallo Welt!")
}
Lisp
(print "Hallo Welt!")
or
(princ "Hallo Welt!")
(terpri)
With terpri there is a line break.
logo
print [Hallo Welt!]
Lua
print ("Hallo Welt!")
However, the brackets around the string can be omitted here:
print "Hallo Welt!"
Matlab
fprintf('Hallo Welt!');
or
disp('Hallo Welt!');
or
disp Hallo_Welt
or
'Hallo Welt'
mIRC Script
on 1:load:*: { echo Hallo Welt! }
MS-DOS batch
echo Hallo Welt!
Oberon
MODULE HalloWelt;
IMPORT Write;
BEGIN
Write.Line("Hallo Welt!");
END HalloWelt.
Object Pascal
CLI:
begin
write('Hallo Welt!');
end.
GUI:
{$APPTYPE GUI}
uses Dialogs;
begin
ShowMessage('Hallo Welt!');
end.
OCaml
print_endline "Hallo Welt!";;
Objective-C
#import <stdio.h>
int main()
{
puts("Hallo Welt!");
return 0;
}
Or with the help of the Foundation framework (and in the new typical notation):
#import <Foundation/Foundation.h>
int main() {
NSLog(@"Hallo Welt!");
return 0;
}
Objective-C with Cocoa
#import <Cocoa/Cocoa.h>
@interface Controller : NSObject
{
NSWindow *window;
NSTextField *textField;
}
@end
int main(int argc, const char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSApp = [NSApplication sharedApplication];
Controller *controller = [[Controller alloc] init];
[NSApp run];
[controller release];
[NSApp release];
[pool release];
return EXIT_SUCCESS;
}
@implementation Controller
- (id)init
{
if ((self = [super init]) != nil) {
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(10.0, 10.0, 85.0, 20.0)];
[textField setEditable:NO];
[textField setStringValue:@"Hallo Welt!"];
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(100.0, 350.0, 200.0, 40.0)
styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask
backing:NSBackingStoreBuffered
defer:YES];
[window setDelegate:self];
[window setTitle:@"Hallo Welt!"];
[[window contentView] addSubview:textField];
[window makeKeyAndOrderFront:nil];
}
return self;
}
- (void)windowWillClose:(NSNotification *)notification
{
[NSApp terminate:self];
}
@end
OpenLaszlo
<canvas>
<text>Hallo Welt!</text>
</canvas>
Oz
{Show 'Hallo Welt'}
P ++
Terminal terminal = new Terminal(1);
terminal.create();
terminal.output("Hallo Welt!").nextLine();
Pascal
program Hallo_Welt(output);
begin
writeln('Hallo Welt!')
end.
PAWN
main()
{
printf("Hallo Welt!\n");
}
PEARL
MODULE (HALLOWELT);
SYSTEM;
TERMINAL:DIS<->SDVLS(2);
PROBLEM;
SPC TERMINAL DATION OUT ALPHIC DIM(,) TFU MAX FORWARD CONTROL (ALL);
MAIN:TASK;
OPEN TERMINAL;
PUT 'Hallo Welt!' TO TERMINAL;
CLOSE TERMINAL;
END;
MODEND;
Pearl 5
#### Ausgabe auf STDOUT ####
print "Hallo Welt!\n"; # " statt ', damit \n in Zeilenumbruch umgewandelt wird
printf 'Hallo Welt%s', "\n"; # flexibler, wie C's printf (wieder "\n", nicht '\n')
#### Ausgabe auf STDERR (Zeilenumbruch wird automatisch angehängt) ####
warn 'Aber hallo, Welt!'; # mit Fehlermeldung (Programmdatei und Zeile)
die 'Lebewohl, Welt!'; # mit Fehlermeldung und Programmbeendigung
or
use feature qw(say);
say "Hallo Welt!"; # automatisch angehängter Zeilenumbruch
Perl 5 with Tk
use Tk;
$init_win = new MainWindow;
$label = $init_win -> Label(
-text => "Hallo Welt!"
) -> pack(
-side => top
);
$button = $init_win -> Button(
-text => "Ok",
-command => sub {exit}
) -> pack(
-side => top
);
MainLoop;
Perl 5 with Wx
use Wx;
App->new->MainLoop;
package App;
use parent qw(Wx::App);
sub OnInit { Wx::Frame->new( undef, -1, 'Hallo Welt!')->Show() }
Pearl 6
#### Ausgabe auf STDOUT: ####
say 'Hallo Welt!'; # hängt Zeilenumbruch automatisch an
put 'Hallo Welt!'; # dito, bei einfachen Strings identisch zu say()
print "Hallo Welt!\n"; # " statt ', damit \n in Zeilenumbruch umgewandelt wird
printf 'Hallo Welt%s', "\n"; # flexibler, wie C's printf (wieder "\n", nicht '\n')
## objektorientierter Aufruf (alles ist ein Objekt):
'Hallo Welt!'.say;
'Hallo Welt!'.put;
"Hallo Welt!\n".print;
'Hallo Welt!%s'.printf("\n"); # Zweites Argument bleibt ein Argument:
('Hallo Welt!%s', "\n").printf; # Das hier geht nicht!
#### Ausgabe auf STDERR (alle mit automatischem Zeilenumbruch): ####
note 'Aber hallo, Welt!'; # einfache Ausgabe
warn 'Aber hallo, Welt!'; # mit Fehlermeldung (Programmdatei und Zeile)
die 'Lebewohl, Welt!'; # mit Fehlermeldung und Programmbeendigung
## objektorientierter Aufruf analog zu oben
PHP
<?php
print "Hallo Welt!";
?>
or:
<?php
echo "Hallo Welt!";
?>
or:
<?="Hallo Welt!"?>
or alternatively for CLI applications :
<?php
fwrite(STDOUT, "Hallo Welt!");
?>
pike
int main() {
write("Hallo Welt!\n");
return 0;
}
PL / I
Test: procedure options(main);
put skip list("Hallo Welt!");
end Test;
PL / pgSQL procedural language extension of PostgreSQL
BEGIN; -- Eine Transaktion beginnen.
-- Eine Funktion namens hallo wird angelegt.
-- "void" bedeutet, dass nichts zurückgegeben wird.
CREATE OR REPLACE FUNCTION hallo() RETURNS void AS
-- Der Funktionskörper wird in $$-Stringliteralen gekapselt.
-- Hier steht $body$ zwischen den $-Zeichen.
-- Der Text zwischen den $-Zeichen muss eine Länge von mindestens 0 Zeichen aufweisen.
$body$
BEGIN
RAISE NOTICE 'Hallo Welt'; -- Eine Notiz wird aufgerufen.
END;
$body$ -- Ende des Funktionskörpers.
LANGUAGE plpgsql; -- Die Sprache des Funktionskörpers muss angegeben werden.
SELECT hallo();
-- Die Funktion wird mit einem SELECT aufgerufen.
-- Die Ausgabe der Notiz erfolgt in der Konsole.
ROLLBACK; -- alles rückgängig machen durch Zurückrollen der Transaktion.
PL / SQL procedural language extension from Oracle
CREATE OR REPLACE PROCEDURE HelloWorld as
BEGIN
DBMS_OUTPUT.PUT_LINE('Hallo Welt!');
END;
/
set serveroutput on;
exec HelloWorld;
PocketC
Console:
main() {
puts("Hallo Welt!");
}
Dialog window:
main() {
alert("Hallo Welt!");
}
In a text box:
main() {
box=createctl("EDIT","Test",ES_MULTILINE,0x000,30,30,100,30,3000);
editset(box,"Hallo Welt!");
}
POV-Ray
camera {
location <0, 0, -5>
look_at <0, 0, 0>
}
light_source {
<10, 20, -10>
color rgb 1
}
light_source {
<-10, 20, -10>
color rgb 1
}
background {
color rgb 1
}
text {
ttf "someFont.ttf"
"Hallo Welt!", 0.015, 0
pigment {
color rgb <0, 0, 1>
}
translate -3*x
}
PowerShell
Command line:
"Hallo Welt!"
alternatively:
Write-Host "Hallo Welt!"
or:
echo "Hallo Welt!"
or:
[System.Console]::WriteLine("Hallo Welt!")
Dialog window:
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.MessageBox]::Show("Hallo Welt!")
Progress 4GL
DISPLAY "Hallo Welt!".
or:
MESSAGE "Hallo Welt!"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
prolog
?- write('Hallo Welt!'), nl.
PureBasic
In the console:
OpenConsole()
Print("Hallo Welt!")
Input() ;Beendet das Programm beim naechsten Tastendruck
CloseConsole()
In the dialog window:
MessageRequester("Nachricht","Hallo Welt!")
In the window:
If OpenWindow(1,0,0,300,50,"Hallo Welt!",#PB_Window_ScreenCentered|#PB_Window_SystemMenu) ; Oeffnet ein zentriertes Fenster
TextGadget(1,10,10,280,20,"Hallo Welt!",#PB_Text_Border) ; Erstellt ein Textfeld "Hallo Welt!"
Repeat
event.i = WaitWindowEvent() ; Arbeitet die Windowsevents ab
Until event = #PB_Event_CloseWindow ; solange, bis Schliessen geklickt wird
EndIf
python
Up to and including version 2 ( print
is a keyword ):
print 'Hallo Welt!'
From version 3 ( print
is a function ):
print('Hallo Welt!')
As an Easter Egg :
import __hello__
Python 2 with Tkinter
import Tkinter as tk # `import tkinter as tk' in Python 3
fenster = tk.Tk()
tk.Label(fenster, text="Hallo Welt!").pack()
fenster.mainloop()
QBASIC
PRINT "Hallo Welt!"
R.
print ("Hallo Welt!")
or
cat ("Hallo Welt!\n")
REXX
say "Hallo Welt!"
Ruby
puts "Hallo Welt!"
Ruby with GTK +
require "gtk2"
Gtk::Window.new("Hallo Welt!").show_all.signal_connect(:delete_event){Gtk.main_quit}
Gtk.main
Ruby with Tk
require "tk"
TkRoot.new{ title "Hallo Welt!" }
Tk.mainloop
Rust
fn main() {
println!("Hallo Welt");
}
SAC (Single Assignment C)
use StdIO: all;
int main()
{
printf("Hello World!\n");
return(0);
}
SAS
data _null_;
put "Hallo Welt!";
run;
or (SAS Macro Language)
%put Hallo Welt!;
Scala
As an interpretable script:
println("Hallo Welt!")
Using the Traits App as a translatable file:
object HalloWelt extends App {
println("Hallo Welt!")
}
or Java-like as a translatable file:
object HalloWelt {
def main(args: Array[String]) {
println("Hallo Welt!")
}
}
Scheme
(display "Hallo Welt!")
(newline)
Seed7
$ include "seed7_05.s7i";
const proc: main is func
begin
writeln("Hallo Welt!");
end func;
Small talk
With Enfin Smalltalk :
'Hallo Welt!' out.
With VisualWorks :
Transcript show: 'Hallo Welt!'.
Spec #
using System;
public class Programm
{
public static void Main(string![]! args)
requires forall{int i in (0:args.Length); args[i] != null};
{
Console.WriteLine("Hallo Welt!");
}
}
Standard ML
print "Hallo Welt!\n"
SPL
debug "Hallo Welt!";
SQL
SELECT 'Hallo Welt!' AS message;
For Oracle databases , MySQL
SELECT 'Hallo Welt!' FROM dual;
For IBM-DB2
SELECT 'Hallo Welt!' FROM sysibm.sysdummy1;
For MySQL , PostgreSQL , SQLite and MSSQL
SELECT 'Hallo Welt!';
StarOffice Basic
sub main
print "Hallo Welt!"
end sub
or:
sub HalloWeltAlternativ
MsgBox "Hallo Welt!"
end sub
Swift
println("Hallo Welt!")
(Swift 1.0)
print("Hallo Welt!")
(ab Swift 2.0)
Tcl
puts "Hallo Welt!"
Tcl / Tk
package require Tk
label .l -text "Hallo Welt"
pack .l
XOTcl
proc hello {
puts "Hallo Welt!"
}
Turing
put "Hallo Welt!"
Unix shell
echo 'Hallo Welt!'
Verilog
module hallo_welt;
initial begin
$display ("Hallo Welt!");
#10 $finish;
end
endmodule
VHDL
entity HelloWorld is
end entity HelloWorld;
architecture Bhv of HelloWorld is
begin
HelloWorldProc: process is
begin
report "Hallo Welt!";
wait;
end process HelloWorldProc;
end architecture Bhv;
Visual Basic Script
MsgBox "Hallo Welt!"
Visual Basic .NET
Output in the console:
Module Module1
Sub Main()
Console.WriteLine("Hallo Welt!")
End Sub
End Module
Output in a message box:
Class Hallo
Sub HalloWelt
MsgBox("Hallo Welt!")
End Sub
End Class
See also
- List of Hello World Programs / Others
- List of programming languages
- Timeline of the programming languages
Web links
- The Hello World Collection - contains Hello World programs in 500 programming languages
- Index of Hello World! programs and beyond (English)
- dev.mysql.com