Notice: Unexpected clearActionName after getActionName already called in /var/www/html/includes/context/RequestContext.php on line 338
Liste von Hallo-Welt-Programmen/Höhere Programmiersprachen – Wikipedia Zum Inhalt springen

Liste von Hallo-Welt-Programmen/Höhere Programmiersprachen

aus Wikipedia, der freien Enzyklopädie

Dies ist eine Liste von Hallo-Welt-Programmen für gebräuchliche höhere Programmiersprachen. Für jede Sprache wird vorgeführt, wie man in ihr die einfache Aufgabe löst, den Text „Hallo Welt!“ auf den Bildschirm auszugeben. Weitere Beispiele für grafische Benutzeroberflächen, Web-Technologien, exotische Programmiersprachen und Textauszeichnungssprachen sind unter Liste von Hallo-Welt-Programmen/Sonstige aufgeführt; Beispiele in Assembler für verschiedene Plattformen finden sich unter Liste von Hallo-Welt-Programmen/Assembler. Das kürzeste Hallo-Welt-Programm liefert die Programmiersprache APL, das zweitkürzeste Forth. Beide kommen dabei ohne Funktions- oder Schlüsselwort aus.

A

ABAP

<syntaxhighlight lang="abap" highlight="2"> REPORT Z_HALLO_WELT. WRITE 'Hallo Welt!'. </syntaxhighlight>

ActionScript

<syntaxhighlight lang="actionscript" highlight="1"> trace('Hallo Welt'); </syntaxhighlight>

ActionScript 3.0 und unter Benutzung der DocumentClass:

<syntaxhighlight lang="actionscript3" highlight="6"> package {

   import flash.display.Sprite;
   public class Main extends Sprite {
       public function Main() {
           trace( "Hallo Welt!" );
       }
   }

} </syntaxhighlight>

Ada

<syntaxhighlight lang="ada" highlight="4"> with Ada.Text_IO; procedure Hallo is begin

   Ada.Text_IO.Put_Line ("Hallo Welt!");

end Hallo; </syntaxhighlight>

Für eine Erklärung des Programms siehe Ada Programming/Basic in den englischsprachigen Wikibooks.

Algol 60

<syntaxhighlight lang="qbasic" highlight="2"> 'BEGIN'

   OUTSTRING(2,'('HALLO WELT')');

'END' </syntaxhighlight>

Bei der Sprachdefinition von ALGOL 60 wurden die Ein-/Ausgabeanweisungen ausdrücklich von der Standardisierung ausgenommen, so dass deren Implementierungen stark zwischen den Compilern variieren. So wird dieser Text bei der Electrologica X1 (nach vorheriger Wahl des Ausgabekanals mit SELECTOUTPUT(2); ) mit WRITETEXT('('HALLO WELT')'); statt mit dem OUTSTRING-Befehl ausgegeben.

Algol 68

<syntaxhighlight lang="qbasic" highlight="1"> ( print("Hallo Welt!") ) </syntaxhighlight>

AMOS BASIC

<syntaxhighlight lang="basic"> ? "Hallo Welt!" </syntaxhighlight>

APL

<syntaxhighlight lang="apl" highlight="1"> 'Hallo Welt!' </syntaxhighlight>

AppleScript

<syntaxhighlight lang="qbasic"> display dialog "Hallo Welt!" </syntaxhighlight>

ASP (Active Server Pages)

<syntaxhighlight lang="aspx-vb" highlight="2"> <%

 Response.Write("Hallo Welt!")

%> </syntaxhighlight>

oder verkürzt

<syntaxhighlight lang="aspx-vb" highlight="1"> <%="Hallo Welt!"%> </syntaxhighlight>

AutoHotkey

Variante 1: eine klassische MessageBox

<syntaxhighlight lang="autohotkey" highlight="1"> MsgBox Hallo Welt! </syntaxhighlight>

Variante 2: Startet das Programm Notepad und tippt dort „Hallo Welt“ ein

<syntaxhighlight lang="autohotkey" highlight="3"> Run, "notepad.exe" WinWaitActive, ahk_class Notepad Send, Hallo Welt{!} </syntaxhighlight>

AutoIt

Variante 1: Startet eine normale Messagebox ohne Titel

<syntaxhighlight lang="autoit" highlight="1"> MsgBox(0, "", "Hallo Welt!") </syntaxhighlight>

Variante 2: Startet den Editor, wartet bis dieser aktiv ist, hält das Fenster während der Ausführung des Send-Befehls aktiv und schreibt Hallo Welt! hinein.

<syntaxhighlight lang="autoit" highlight="4"> Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") SendKeepActive("[CLASS:Notepad]") Send("Hallo Welt!",1) </syntaxhighlight>

AutoLISP

<syntaxhighlight lang="lisp" highlight="1"> (princ "Hallo Welt!") </syntaxhighlight>

awk

<syntaxhighlight lang="awk" highlight="1"> BEGIN { print "Hallo Welt!" } </syntaxhighlight>

B

B

<syntaxhighlight lang="c" highlight="2"> main() {

   printf("Hallo Welt!");

} </syntaxhighlight>

bash

<syntaxhighlight lang="bash" highlight="1"> echo "Hallo Welt!" ; </syntaxhighlight>

BASIC

Traditionelles, unstrukturiertes BASIC:

<syntaxhighlight lang="qbasic" highlight="1"> 10 PRINT "Hallo Welt!" </syntaxhighlight>

bzw. im Direktmodus:

<syntaxhighlight lang="qbasic" highlight="1"> ?"Hallo Welt!" </syntaxhighlight>

Batch

Die Kommandozeilenbefehlssprache von MS-DOS, PC DOS, DR-DOS und Windows NT. <syntaxhighlight lang="batch" highlight="1"> @echo Hallo Welt! </syntaxhighlight>

BeanShell

<syntaxhighlight lang="c" highlight="1"> print("Hallo Welt!"); </syntaxhighlight>

Blitz Basic

Ohne GUI: <syntaxhighlight lang="qbasic" highlight="1"> Print "Hallo Welt" WaitKey End </syntaxhighlight>

Mit GUI (BlitzPlus) <syntaxhighlight lang="text" highlight="2"> window = CreateWindow("Hallo Welt! Fenster", 0, 0, 100, 80, 0, 1) label = CreateLabel("Hallo Welt!", 5, 5, 80, 20, window) Repeat Until WaitEvent() = $803 </syntaxhighlight>

BlitzMax

<syntaxhighlight lang="qbasic" highlight="2"> Framework BRL.StandardIO Print("Hallo Welt!") </syntaxhighlight>

Boo

<syntaxhighlight lang="boo" highlight="1"> print "Hallo Welt!" </syntaxhighlight>

C

C

<syntaxhighlight lang="c" highlight="4">

  1. include <stdio.h>

int main() {

   puts("Hallo Welt!");
   return 0;

} </syntaxhighlight> {{#invoke:Vorlage:Siehe auch|f}}

C unter Benutzung der POSIX-API

<syntaxhighlight lang="c" highlight="7">

  1. include <unistd.h>

const char HALLOWELT[] = "Hallo Welt!\n";

int main(void) {

   write(STDOUT_FILENO, HALLOWELT, sizeof HALLOWELT - 1);
   return 0;

} </syntaxhighlight>

C mit GTK

<syntaxhighlight lang="c">

  1. 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();

} </syntaxhighlight>

C mit Windows API

<syntaxhighlight lang="c" highlight="5">

  1. include <windows.h>

VOID WINAPI WinMainCRTStartup(VOID) {

   MessageBox(HWND_DESKTOP, "Hallo Welt!", "Mein erstes Programm", MB_OK);
   ExitProcess(0);

} </syntaxhighlight>

C++

<syntaxhighlight lang="cpp" highlight="5">

  1. include <iostream>

int main() {

   std::cout << "Hello, world!\n";

} </syntaxhighlight>

Die moderne Version von C++23:

<syntaxhighlight lang="cpp" highlight="5"> import std;

int main() {

   std::println("Hallo Welt!");

} </syntaxhighlight>

C++/CLI

<syntaxhighlight lang="cpp" highlight="3"> int main() {

   System::Console::WriteLine("Hallo Welt!");

} </syntaxhighlight>

C++/CX

<syntaxhighlight lang="cpp" highlight="9">

  1. include "stdafx.h"
  2. using <Platform.winmd>

using namespace Platform;

[MTAThread] int main(Array<String^>^ args) {

   String^ message("Hallo Welt!");
   Details::Console::WriteLine(message);

} </syntaxhighlight>

C++ mit gtkmm

<syntaxhighlight lang="cpp" highlight="9">

  1. include <gtkmm/main.h>
  2. include <gtkmm/button.h>
  3. 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);

} </syntaxhighlight>

C++ mit Qt

<syntaxhighlight lang="cpp" highlight="7">

  1. include <QLabel>
  2. include <QApplication>

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

   QApplication app(argc, argv);
   QLabel label("Hallo Welt!");
   label.show();
   app.exec();

} </syntaxhighlight>

C#

Ausgabe in der Konsole: <syntaxhighlight lang="csharp" highlight="5"> static class Program {

   static void Main()
   {
       System.Console.WriteLine("Hallo Welt!");
   }

} </syntaxhighlight>

Ab C# 9 werden Anweisungen auf oberster Ebene unterstützt. Es wird keine Hauptklasse und keine Hauptmethode benötigt:<ref>{{#if:|{{#iferror: {{#iferror:{{#invoke:Vorlage:FormatDate|Execute}}|}}| |}}}}{{#if:Bill Wagner et al.|Bill Wagner et al.: }}{{#if:|{{#if:What’s new in C# 9.0|[{{#invoke:Vorlage:Internetquelle|archivURL|1={{#invoke:URLutil|getNormalized|1={{{archiv-url}}}}}}} {{#invoke:Vorlage:Internetquelle|TitelFormat|titel=What’s new in C# 9.0}}]{{#if:| ({{{format}}})}}{{#if:Top-level statements| Top-level statements{{#invoke:Vorlage:Internetquelle|Endpunkt|titel=Top-level statements}}}}}}|{{#if:https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements%7C{{#if:{{#invoke:TemplUtl%7Cfaculty%7C}}%7C{{#invoke:Vorlage:Internetquelle%7CTitelFormat%7Ctitel={{#invoke:WLink%7CgetEscapedTitle%7C1=What’s new in C# 9.0}}}}|[{{#invoke:URLutil|getNormalized|1=https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements}} {{#invoke:Vorlage:Internetquelle|TitelFormat|titel={{#invoke:WLink|getEscapedTitle|1=What’s new in C# 9.0}}}}]}}{{#if:| ({{{format}}}{{#if:Top-level statementslearn.microsoft.comMicrosoft2023-02-21{{#if: 2023-07-04 | {{#if:{{#invoke:TemplUtl|faculty|}}||1}}}}

          | )
          | {{#if:{{#ifeq:en|de||{{#if:en|1}}}}| ; 
              | )}}}}}}{{#if:Top-level statements| Top-level statements{{#invoke:Vorlage:Internetquelle|Endpunkt|titel=Top-level statements}}}}}}}}{{#if:https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements%7C{{#if:{{#invoke:URLutil%7CisResourceURL%7C1=https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements}}%7C%7C}}}}{{#if:What’s new in C# 9.0|{{#if:{{#invoke:WLink|isValidLinktext|1=What’s new in C# 9.0|lines=0}}||}}}}{{#if: learn.microsoft.com| In: {{#invoke:Vorlage:Internetquelle|TitelFormat|titel=learn.microsoft.com}}}}{{#if: Microsoft| Microsoft{{#if: 2023-02-21|,|{{#if: 2023-07-04 | {{#if:{{#invoke:TemplUtl|faculty|}}|;|,}}}}}}}}{{#if: 2023-02-21| {{#if:{{#invoke:DateTime|format|2023-02-21|noerror=1}}
            |{{#invoke:DateTime|format|2023-02-21|T._Monat JJJJ}}
            |{{#invoke:TemplUtl|failure|1=Fehler bei Vorlage:Internetquelle, datum=2023-02-21|class=Zitationswartung}} }}{{#if: |,|{{#if: 2023-07-04 | {{#if:{{#invoke:TemplUtl|faculty|}}|;|,}}}}}}}}{{#if: | S. {{{seiten}}}{{#if: |,|{{#if: 2023-07-04 | {{#if:{{#invoke:TemplUtl|faculty|}}|;|,}}}}}}}}{{#if: {{#invoke:TemplUtl|faculty|}}| {{#if:2023-02-21Microsoft|{{#if:|archiviert|ehemals}}|{{#if:|Archiviert|Ehemals}}}} {{#if:|vom|im}} Vorlage:Referrer{{#if:{{#invoke:TemplUtl|faculty|}}| (nicht mehr online verfügbar)}}{{#if: | am {{#iferror: {{#iferror:{{#invoke:Vorlage:FormatDate|Execute}}|}}|{{{archiv-datum}}}{{#if:1094891||(?)}}}}}}{{#if: 2023-07-04|;}}}}{{#if: 2023-07-04| {{#if:2023-02-21Microsoft{{#invoke:TemplUtl|faculty|}}|abgerufen|Abgerufen}} {{#switch: {{#invoke:Str|len| {{#invoke:DateTime|format| 2023-07-04 |ISO|noerror=1}} }}
       |4=im Jahr
       |7=im
       |10=am
       |#default={{#invoke:TemplUtl|failure|1=Fehler bei Vorlage:Internetquelle, abruf=2023-07-04|class=Zitationswartung}} }} {{#invoke:DateTime|format|2023-07-04|T._Monat JJJJ}}
    | {{#invoke:TemplUtl|failure|1=Vorlage:Internetquelle | abruf=2026-MM-TT ist Pflichtparameter}} }}{{#if:{{#ifeq:en|de||{{#if:en|1}}}}|{{#if:Top-level statementslearn.microsoft.comMicrosoft2023-02-21{{#if: 2023-07-04 | {{#if:{{#invoke:TemplUtl|faculty|}}||1}}}}
       |  (
       | {{#if: | |  (}}
       }}{{#ifeq:{{#if:en|en|de}}|de||
          {{#invoke:Multilingual|format|en|slang=!|split=[%s,]+|shift=m|separator=, }}}}{{#if: |{{#ifeq:{{#if:en|en|de}}|de||, }}{{{kommentar}}}}})}}{{#if: 2023-02-21{{#if: 2023-07-04 | {{#if:{{#invoke:TemplUtl|faculty|}}||1}} }}en|{{#if: |: {{
 #if: 
 | {{
     #ifeq: {{#if:{{#if: {{#invoke:templutl|faculty|}}|de-ch|de}}|{{#if: {{#invoke:templutl|faculty|}}|de-ch|de}}|de}} | de
     | Vorlage:Str trim
     | {{#invoke:Vorlage:lang|flat}}
     }}
 | {{#ifeq: {{#if:{{#if: {{#invoke:templutl|faculty|}}|de-ch|de}}|{{#if: {{#invoke:templutl|faculty|}}|de-ch|de}}|de}} | de
     | „Vorlage:Str trim“
     | {{#invoke:Text|quote
         |1={{#if: 
              | {{#invoke:Vorlage:lang|flat}}
              | {{#invoke:Vorlage:lang|flat}} }}
         |2={{#if: {{#invoke:TemplUtl|faculty|}}|de-CH|de}}
         |3=1}} }}

}}{{#if:

   |  (<templatestyles src="Person/styles.css" />{{#if:  | :  }}{{#if:  | , deutsch: „“ }})
   | {{#if: 
       |  ({{#if:  | , deutsch: „“ }})
       | {{#if:  |  (deutsch: „“) }}
 }}

}}{{#if: {{{zitat}}}

   | {{#if: 
       | {{#if: {{{zitat}}}
           | Vorlage:": Text= und 1= gleichzeitig, bzw. Pipe zu viel }} }}
   | Vorlage:": Text= fehlt }}{{#if:  | {{#if: {{#invoke:Text|unstrip|{{{ref}}}}}
             | Vorlage:": Ungültiger Wert: ref=
             | {{{ref}}} }}

}}|.{{#if:{{#invoke:TemplUtl|faculty|}}|{{#if:||{{#ifeq: | JaKeinHinweis |{{#switch:

   |0|=Vorlage:Toter Link/Core{{#if: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements
       | {{#if:  | [1] }} (Seite {{#switch:|no|0|=|dauerhaft }}nicht mehr abrufbar{{#if:  | , festgestellt im {{#invoke:DateTime|format||F Y}} }}. Suche im Internet Archive ){{#if: 
           | {{#if: deadurlausgeblendet | | Vorlage:Toter Link/archivebot }}
         }}
       |   (Seite {{#switch:|no|0|=|#default=dauerhaft }}nicht mehr abrufbar{{#if:  | , festgestellt im {{#invoke:DateTime|format||F Y}} }}.)
     }}{{#switch: 
         |no|0|=
         |#default={{#if:  ||  }}
    }}{{#invoke:TemplatePar|check
         |opt      = inline= url= text= datum= date= archivebot= bot= botlauf= fix-attempted= checked=
         |cat      = Wikipedia:Vorlagenfehler/Vorlage:Toter Link
         |errNS    = 0
         |template = Vorlage:Toter Link
         |format   = 
         |preview  = 1
    }}{{#if: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements
      | {{#if:{{#invoke:URLutil|isWebURL|https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements}}
          || {{#if:  ||  }} 
        }}
      | {{#if: 
           | {{#if:  ||  }}
           | {{#if:  ||  }}
        }}
    }}{{#if: 
       | {{#if:{{#invoke:DateTime|format||F Y|noerror=1}}
             || {{#if:  ||  }} 
         }}
    }}{{#switch: deadurl
         |checked|deadurl|= 
         |#default=  {{#if:  ||  }}
    }}|#default= https://wiki-de.moshellshocker.dns64.de/index.php?title=Wikipedia:Defekte_Weblinks&dwl=https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements Die nachstehende Seite ist {{#switch:|no|0|=|dauerhaft }}nicht mehr abrufbar]{{#if:  | , festgestellt im {{#invoke:DateTime|format||F Y}} }}. (Suche im Internet Archive. )  {{#if: 
            | {{#if: deadurlausgeblendet | | Vorlage:Toter Link/archivebot }}
         }}Vorlage:Toter Link/Core{{#switch: 
          |no|0|=
          |#default= {{#if:  ||  }}
        }}{{#invoke:TemplatePar|check
         |all      = inline= url=
         |opt      = datum= date= archivebot= bot= botlauf= fix-attempted= checked=
         |cat      = Wikipedia:Vorlagenfehler/Vorlage:Toter Link
         |errNS    = 0
         |template = Vorlage:Toter Link
         |format   = 
         |preview  = 1
       }}{{#if: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements
       | {{#if:{{#invoke:URLutil|isWebURL|https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements}}
          || {{#if:  ||  }} 
        }}
    }}{{#if: 
         | {{#if:{{#invoke:DateTime|format||F Y|noerror=1}}
             || {{#if:  ||  }} 
           }}
    }}{{#switch: deadurl
         |checked|deadurl|= 
         |#default=  {{#if:  ||  }}
    }}[https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements }}|{{#switch: 
   |0|=Vorlage:Toter Link/Core{{#if: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements
       | {{#if:  | [2] }} (Seite {{#switch:|no|0|=|dauerhaft }}nicht mehr abrufbar{{#if:  | , festgestellt im {{#invoke:DateTime|format||F Y}} }}. Suche im Internet Archive ){{#if: 
           | {{#if:  | | Vorlage:Toter Link/archivebot }}
         }}
       |   (Seite {{#switch:|no|0|=|#default=dauerhaft }}nicht mehr abrufbar{{#if:  | , festgestellt im {{#invoke:DateTime|format||F Y}} }}.)
     }}{{#switch: 
         |no|0|=
         |#default={{#if:  ||  }}
    }}{{#invoke:TemplatePar|check
         |opt      = inline= url= text= datum= date= archivebot= bot= botlauf= fix-attempted= checked=
         |cat      = Wikipedia:Vorlagenfehler/Vorlage:Toter Link
         |errNS    = 0
         |template = Vorlage:Toter Link
         |format   = 
         |preview  = 1
    }}{{#if: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements
      | {{#if:{{#invoke:URLutil|isWebURL|https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements}}
          || {{#if:  ||  }} 
        }}
      | {{#if: 
           | {{#if:  ||  }}
           | {{#if:  ||  }}
        }}
    }}{{#if: 
       | {{#if:{{#invoke:DateTime|format||F Y|noerror=1}}
             || {{#if:  ||  }} 
         }}
    }}{{#switch: 
         |checked|deadurl|= 
         |#default=  {{#if:  ||  }}
    }}|#default= https://wiki-de.moshellshocker.dns64.de/index.php?title=Wikipedia:Defekte_Weblinks&dwl=https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements Die nachstehende Seite ist {{#switch:|no|0|=|dauerhaft }}nicht mehr abrufbar]{{#if:  | , festgestellt im {{#invoke:DateTime|format||F Y}} }}. (Suche im Internet Archive. )  {{#if: 
            | {{#if:  | | Vorlage:Toter Link/archivebot }}
         }}Vorlage:Toter Link/Core{{#switch: 
          |no|0|=
          |#default= {{#if:  ||  }}
        }}{{#invoke:TemplatePar|check
         |all      = inline= url=
         |opt      = datum= date= archivebot= bot= botlauf= fix-attempted= checked=
         |cat      = Wikipedia:Vorlagenfehler/Vorlage:Toter Link
         |errNS    = 0
         |template = Vorlage:Toter Link
         |format   = 
         |preview  = 1
       }}{{#if: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements
       | {{#if:{{#invoke:URLutil|isWebURL|https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements}}
          || {{#if:  ||  }} 
        }}
    }}{{#if: 
         | {{#if:{{#invoke:DateTime|format||F Y|noerror=1}}
             || {{#if:  ||  }} 
           }}
    }}{{#switch: 
         |checked|deadurl|= 
         |#default=  {{#if:  ||  }}
    }}[https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements }} }}}}}}}}}}{{#if:|
        {{#invoke:Vorlage:Internetquelle|archivBot|stamp={{{archiv-bot}}}|text={{#if:|Vorlage:Webarchiv/archiv-bot}}

}}}}{{#invoke:TemplatePar|check |all= url= titel= |opt= autor= hrsg= format= sprache= titelerg= werk= seiten= datum= abruf= zugriff= abruf-verborgen= archiv-url= archiv-datum= archiv-bot= kommentar= zitat= AT= CH= offline= |cat= {{#ifeq: 0 | 0 | Wikipedia:Vorlagenfehler/Vorlage:Internetquelle}} |template= Vorlage:Internetquelle |format=0 |preview=1 }}</ref>

<syntaxhighlight lang="csharp" highlight="1"> System.Console.WriteLine("Hallo Welt!"); </syntaxhighlight>

Ausgabe in einer Messagebox: <syntaxhighlight lang="csharp" highlight="5"> static class Program {

   static void Main()
   {
       System.Windows.Forms.MessageBox.Show("Hallo Welt");
   }

} </syntaxhighlight>

C/AL

<syntaxhighlight lang="lua" highlight="1"> MESSAGE('Hallo Welt') </syntaxhighlight>

Ceylon

<syntaxhighlight lang="java" highlight="6"> // In der Datei module.ceylon module hello "1.0.0" {}

// In der Datei hallo.ceylon shared void run() {

   print("Hallo Welt!");

} </syntaxhighlight>

CIL

<syntaxhighlight lang="text" highlight="8"> .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

} </syntaxhighlight>

CLIST

<syntaxhighlight lang="asm" highlight="1"> WRITE HALLO WELT </syntaxhighlight>

Clojure

<syntaxhighlight lang="clojure" highlight="1"> (println "Hallo Welt!") </syntaxhighlight>

COBOL

<syntaxhighlight lang="qbasic" highlight="5"> 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOWORLD. 000900 PROCEDURE DIVISION. 001000 MAIN. 001100 DISPLAY "Hallo Welt!". 001200 STOP RUN. </syntaxhighlight>

COLDFUSION

<syntaxhighlight lang="cfm" highlight="1"> <cfset beispiel = "Hallo Welt!" > <cfoutput>#beispiel#</cfoutput> </syntaxhighlight>

COMAL

<syntaxhighlight lang="qbasic" highlight="1"> 10 PRINT "Hallo Welt!" </syntaxhighlight>

Common Lisp

<syntaxhighlight lang="lisp" highlight="1"> (write-line "Hallo Welt!") </syntaxhighlight>

Component Pascal

<syntaxhighlight lang="componentpascal" highlight="5"> MODULE HalloWelt; IMPORT Out; PROCEDURE Output*; BEGIN

  Out.String ("Hallo Welt!");
  Out.Ln;

END Output; END HalloWelt. </syntaxhighlight>

D

D

<syntaxhighlight lang="d" highlight="3"> import std.stdio; void main() {

   writeln("Hallo Welt!");

} </syntaxhighlight>

DarkBASIC

<syntaxhighlight lang="actionscript" highlight="1"> print "Hallo Welt!" wait key </syntaxhighlight>

dBASE, FoxPro und Clipper

Ausgabe in der nächsten freien Zeile:

<syntaxhighlight lang="vfp" highlight="1"> ? "Hallo Welt!" </syntaxhighlight>

Zeilen- und spaltengenaue Ausgabe:

<syntaxhighlight lang="vfp" highlight="1"> @1,1 say "Hallo Welt!" </syntaxhighlight>

Ausgabe in einem Fenster:

<syntaxhighlight lang="vfp" highlight="1"> wait window "Hallo Welt!" </syntaxhighlight>

Dylan

<syntaxhighlight lang="dylan" highlight="1"> define method hallo-welt()

    format-out("Hallo Welt!\n");

end method hallo-welt;

hallo-welt(); </syntaxhighlight>

E

Eiffel

<syntaxhighlight lang="eiffel" highlight="7"> class HALLO_WELT create

   make

feature

   make is
   do
       io.put_string("Hallo Welt!%N")
   end

end </syntaxhighlight>

ELAN

<syntaxhighlight lang="c" highlight="1"> putline ("Hallo Welt!"); </syntaxhighlight>

Elixir

<syntaxhighlight lang="elixir"> IO.puts "Hello World" </syntaxhighlight> oder: <syntaxhighlight lang="elixir"> defmodule HelloWorld do

   def hello() do
       IO.puts "Hello World!"
   end

end </syntaxhighlight>

Emacs Lisp (Elisp)

<syntaxhighlight lang="lisp" highlight="1"> (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)

</syntaxhighlight>

(print ...) akzeptiert noch exotischere Möglichkeiten als BUFFER oder MARKER, die aber zu weit weg von einer simplen Ausgabe führen und deshalb hier nicht aufgeführt werden.

Keine der oben aufgeführten Möglichkeiten schreibt auf STDOUT oder STDERR, weil Elisp innerhalb von Emacs ausgeführt wird, der im typischen Einsatz kein befehlszeilenorientiertes Programm, sondern nach innen orientiert ist. Die am Anfang aufgeführten Varianten, die normalerweise in den Minibuffer schreiben, schreiben aber stattdessen auf STDERR, wenn man Emacs nicht-interaktiv (Option --batch) auf der Befehlszeile startet:

<syntaxhighlight lang="bash" highlight="1"> > 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! </syntaxhighlight>

Die Möglichkeit, auf STDOUT auszugeben, gibt es wohl nicht.

Erlang

<syntaxhighlight lang="erlang" highlight="4"> -module(hallo). -export([hallo_welt/0]).

hallo_welt() -> io:fwrite("Hallo Welt!\n"). </syntaxhighlight>

F

F#

<syntaxhighlight lang="fsharp" highlight="1"> printfn "Hallo Welt" </syntaxhighlight>

Forth

Als Wort:

<syntaxhighlight lang="forth">

hallo-welt

." Hallo, Welt!" cr

</syntaxhighlight>

bzw. im Direktmodus:

<syntaxhighlight lang="forth"> .( Hallo, Welt!) cr </syntaxhighlight>

Fortran

<syntaxhighlight lang="fortran" highlight="2"> program hallo

  print *, "Hallo Welt!"

end program hallo </syntaxhighlight>

Fortress

<syntaxhighlight lang="dylan" highlight="3"> component HalloWelt

 export Executable
 run(args:String) = print "Hallo Welt!"

end </syntaxhighlight>

FreeBASIC

<syntaxhighlight lang="basic" highlight="1"> print "Hallo Welt!" sleep </syntaxhighlight>

G

GML

<syntaxhighlight lang="qbasic" highlight="1"> show_message("Hallo Welt!"); </syntaxhighlight>

oder: <syntaxhighlight lang="qbasic" highlight="1"> draw_text(x,y,"Hallo Welt!"); </syntaxhighlight>

Gambas

<syntaxhighlight lang="vbnet" highlight="2"> PUBLIC SUB Form_Enter()

   PRINT "Hallo Welt!"

END </syntaxhighlight>

Go

<syntaxhighlight lang="go" highlight="6"> package main

import "fmt"

func main() { fmt.Println("Hallo Welt!") } </syntaxhighlight>

Groovy

<syntaxhighlight lang="groovy" highlight="1"> println "Hallo Welt!" </syntaxhighlight>

H

Haskell

<syntaxhighlight lang="haskell" highlight="2"> main :: IO () main = putStrLn "Hallo Welt!" </syntaxhighlight>

Haxe

<syntaxhighlight lang="actionscript" highlight="3"> class Test {

   static function main() {
       trace("Hallo Welt!");
   }

} </syntaxhighlight>

Die daraus kompilierten SWF- oder Neko-Bytecodes sind allein lauffähig. Zur Verwendung von kompiliertem JavaScript zusätzlich nötig: <syntaxhighlight lang="html" highlight="3"> <html><body>

<script type=“text/javascript“ src=“hallo_welt_haxe.js“></script> </body></html> </syntaxhighlight>

I

IDL (RSI)

<syntaxhighlight lang="text" highlight="2"> PRO hallo_welt

   PRINT, "Hallo Welt!"

END </syntaxhighlight>

Io

<syntaxhighlight lang="io" highlight="1"> "Hallo Welt!" print </syntaxhighlight>

J

J#

<syntaxhighlight lang="csharp" highlight="5"> public class HalloWelt {

   public static void main(String[] args)
   {
       System.Console.WriteLine("Hallo Welt!");
   }

} </syntaxhighlight>

JavaScript

Im Browser

<syntaxhighlight lang="javascript" highlight="1"> document.write("Hallo Welt!"); </syntaxhighlight>

Mit Node.js

<syntaxhighlight lang="javascript" highlight="1"> console.log("Hallo Welt!"); </syntaxhighlight>

Java

Ausgabe in der Konsole: <syntaxhighlight lang="java" highlight="3"> class Hallo {

 public static void main( String[] args ) {
   System.out.println("Hallo Welt!");
 }

} </syntaxhighlight>

Ausgabe in einer Messagebox mit dem GUI-Toolkit Swing: <syntaxhighlight lang="java" highlight="4"> import javax.swing.*; class Hallo {

 public static void main( String[] args ) {
   JOptionPane.showMessageDialog( null, "Hallo Welt!" );
 }

} </syntaxhighlight>

Java-Applet

Java-Applets funktionieren in Verbindung mit HTML.

Die Java-Datei:

<syntaxhighlight lang="java" highlight="6"> import java.applet.*; import java.awt.*;

public class HalloWelt extends Applet {

 public void paint(Graphics g) {
   g.drawString("Hallo Welt!", 100, 50);
 }

} </syntaxhighlight>

Nachfolgend der Code zum Einbau in eine HTML-Seite. Vom W3C empfohlen:

<syntaxhighlight lang="html" highlight="1"> <object classid="java:HalloWelt.class"

       codetype="application/java-vm"
       width="600" height="100">

</object> </syntaxhighlight>

Für Kompatibilität zu sehr alten Browsern (nicht empfohlen):

<syntaxhighlight lang="html" highlight="1"> <applet code="HalloWelt.class"

       width="600" height="100">

</applet> </syntaxhighlight>

Julia

<syntaxhighlight lang="scala" highlight="1"> println("Hallo Welt!") </syntaxhighlight>

K

KiXtart

<syntaxhighlight lang="qbasic" highlight="1"> ? "Hallo Welt!" </syntaxhighlight>

Kotlin

<syntaxhighlight lang="kotlin" highlight="2"> fun main() {

   println("Hallo Welt!")

} </syntaxhighlight>

L

Lisp

<syntaxhighlight lang="lisp" highlight="1"> (print "Hallo Welt!") </syntaxhighlight>

oder

<syntaxhighlight lang="lisp" highlight="1"> (princ "Hallo Welt!") (terpri) </syntaxhighlight> Mit terpri erfolgt Zeilenumbruch.

<syntaxhighlight lang="lisp" highlight="2"> print [Hallo Welt!] </syntaxhighlight>

Lua

<syntaxhighlight lang="lua" highlight="1"> print ("Hallo Welt!") </syntaxhighlight>

Hierbei können die Klammern um den String allerdings weggelassen werden:

<syntaxhighlight lang="lua" highlight="1"> print "Hallo Welt!" </syntaxhighlight>

M

Matlab

<syntaxhighlight lang="matlab" highlight="1"> fprintf('Hallo Welt!'); </syntaxhighlight>

oder

<syntaxhighlight lang="matlab" highlight="1"> disp('Hallo Welt!'); </syntaxhighlight>

oder

<syntaxhighlight lang="matlab" highlight="1"> disp Hallo_Welt </syntaxhighlight>

oder

<syntaxhighlight lang="matlab" highlight="1"> 'Hallo Welt' </syntaxhighlight>

mIRC Script

<syntaxhighlight lang="text" highlight="1"> on 1:load:*: { echo Hallo Welt! } </syntaxhighlight>

MS-DOS Batch

<syntaxhighlight lang="dosbatch" highlight="2"> @echo off echo Hallo Welt! </syntaxhighlight>

O

Oberon

<syntaxhighlight lang="componentpascal" highlight="4"> MODULE HalloWelt; IMPORT Write; BEGIN

   Write.Line("Hallo Welt!");

END HalloWelt. </syntaxhighlight>

Object Pascal

CLI: <syntaxhighlight lang="delphi" highlight="2"> begin

 write('Hallo Welt!');

end. </syntaxhighlight>

GUI: <syntaxhighlight lang="delphi" highlight="4"> {$APPTYPE GUI} uses Dialogs; begin

 ShowMessage('Hallo Welt!');

end. </syntaxhighlight>

OCaml

<syntaxhighlight lang="ocaml" highlight="1"> print_endline "Hallo Welt!";; </syntaxhighlight>

Objective-C

<syntaxhighlight lang="objc" highlight="4">

  1. import <stdio.h>

int main() {

 puts("Hallo Welt!");
 return 0;

} </syntaxhighlight>

Oder mit Hilfe des Foundation-Frameworks (und in neuer typischer Schreibweise): <syntaxhighlight lang="objc" highlight="3">

  1. import <Foundation/Foundation.h>

int main() {

NSLog(@"Hallo Welt!");
return 0;

} </syntaxhighlight>

Objective-C mit Cocoa

<syntaxhighlight lang="objc" highlight="33">

  1. 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 </syntaxhighlight>

OpenLaszlo

<syntaxhighlight lang="xml" highlight="2"> <canvas>

  <text>Hallo Welt!</text>

</canvas> </syntaxhighlight>

Oz

<syntaxhighlight lang="lua"> {Show 'Hallo Welt'} </syntaxhighlight>

P

Pascal

<syntaxhighlight lang="pascal" highlight="3"> program Hallo_Welt(output); begin

 writeln('Hallo Welt!')

end. </syntaxhighlight>

PEARL

<syntaxhighlight lang="modula2"> 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; </syntaxhighlight>

Perl 5

<syntaxhighlight lang="perl" highlight="1">

        1. 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')

        1. Ausgabe auf STDERR (Zeilenumbruch wird automatisch angehängt) ####

warn 'Aber hallo, Welt!'; # mit Fehlermeldung (Programmdatei und Zeile) die 'Lebewohl, Welt!'; # mit Fehlermeldung und Programmbeendigung </syntaxhighlight>

oder

<syntaxhighlight lang="perl" highlight="2"> use feature qw(say); say "Hallo Welt!"; # automatisch angehängter Zeilenumbruch </syntaxhighlight>

Perl 5 mit Tk

<syntaxhighlight lang="perl" highlight="12"> 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; </syntaxhighlight>

Perl 5 mit Wx

<syntaxhighlight lang="perl" highlight="12"> use Wx;

App->new->MainLoop;

package App; use parent qw(Wx::App);

sub OnInit { Wx::Frame->new( undef, -1, 'Hallo Welt!')->Show() } </syntaxhighlight>

Perl 6

<syntaxhighlight lang="perl6" highlight="1">

        1. 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')

    1. 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!

        1. 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

    1. objektorientierter Aufruf analog zu oben

</syntaxhighlight>

PHP

<syntaxhighlight lang="php" highlight="2"> <?php

   print "Hallo Welt!";

?> </syntaxhighlight>

oder:

<syntaxhighlight lang="php" highlight="2"> <?php

   echo "Hallo Welt!";

?> </syntaxhighlight>

oder:

<syntaxhighlight lang="php" highlight="1"> <?="Hallo Welt!"?> </syntaxhighlight>

oder alternativ bei CLI-Anwendungen:

<syntaxhighlight lang="php" highlight="2"> <?php

   fwrite(STDOUT, "Hallo Welt!");

?> </syntaxhighlight>

Pike

<syntaxhighlight lang="pike" highlight="2"> int main() {

   write("Hallo Welt!\n");
   return 0;

} </syntaxhighlight>

PL/I

<syntaxhighlight lang="rexx" highlight="2"> Test: procedure options(main);

   put skip list("Hallo Welt!");

end Test; </syntaxhighlight>

PL/pgSQL prozedurale Spracherweiterung von PostgreSQL

<syntaxhighlight lang="postgresql" highlight="15"> 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. </syntaxhighlight>

PL/SQL prozedurale Spracherweiterung von Oracle

<syntaxhighlight lang="psql" highlight="7"> CREATE OR REPLACE PROCEDURE HelloWorld as BEGIN

  DBMS_OUTPUT.PUT_LINE('Hallo Welt!');

END; / set serveroutput on; exec HelloWorld; </syntaxhighlight>

PocketC

Konsole: <syntaxhighlight lang="c" highlight="2"> main() {

 puts("Hallo Welt!");

} </syntaxhighlight>

Dialogfenster:

<syntaxhighlight lang="c" highlight="2"> main() {

 alert("Hallo Welt!");

} </syntaxhighlight>

In einer Textbox:

<syntaxhighlight lang="c" highlight="3"> main() {

 box=createctl("EDIT","Test",ES_MULTILINE,0x000,30,30,100,30,3000);
 editset(box,"Hallo Welt!");

} </syntaxhighlight>

POV-Ray

<syntaxhighlight lang="pov" highlight="16"> 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

} </syntaxhighlight>

PowerShell

Kommandozeile:

<syntaxhighlight lang="powershell" highlight="1"> "Hallo Welt!" </syntaxhighlight>

alternativ:

<syntaxhighlight lang="powershell" highlight="1"> Write-Host "Hallo Welt!" </syntaxhighlight>

oder:

<syntaxhighlight lang="powershell" highlight="1"> echo "Hallo Welt!" </syntaxhighlight>

oder:

<syntaxhighlight lang="powershell" highlight="1"> [System.Console]::WriteLine("Hallo Welt!") </syntaxhighlight>

Dialogfenster:

<syntaxhighlight lang="powershell" highlight="1"> [void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [System.Windows.Forms.MessageBox]::Show("Hallo Welt!") </syntaxhighlight>

Progress 4GL

<syntaxhighlight lang="progress" highlight="1"> DISPLAY "Hallo Welt!". </syntaxhighlight> oder: <syntaxhighlight lang="progress" highlight="1"> MESSAGE "Hallo Welt!"

 VIEW-AS ALERT-BOX INFO BUTTONS OK.

</syntaxhighlight>

Prolog

<syntaxhighlight lang="prolog" highlight="1"> ?- write('Hallo Welt!'), nl. </syntaxhighlight>

PureBasic

In der Konsole:

<syntaxhighlight lang="text" highlight="2"> OpenConsole()

 Print("Hallo Welt!")
 Input() ;Beendet das Programm beim naechsten Tastendruck

CloseConsole() </syntaxhighlight> Im Dialogfenster: <syntaxhighlight lang="text" highlight="1"> MessageRequester("Nachricht","Hallo Welt!") </syntaxhighlight> Im Fenster: <syntaxhighlight lang="text" highlight="2"> 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 </syntaxhighlight>

Python

Bis einschließlich Version 2 (print ist ein Schlüsselwort):

<syntaxhighlight lang="python" highlight="1"> print 'Hallo Welt!' </syntaxhighlight>

Ab Version 3 (print ist eine Funktion):

<syntaxhighlight lang="python" highlight="1"> print('Hallo Welt!') </syntaxhighlight> oder mit doppelten Anführungszeichen <syntaxhighlight lang="python" highlight="1"> print("Hallo Welt!") </syntaxhighlight>

Als Easter Egg:

<syntaxhighlight lang="python" highlight="1"> import __hello__ </syntaxhighlight>

Python mit Tkinter

<syntaxhighlight lang="python" highlight="4"> from tkinter import * #'Tkinter' anstatt 'tkinter' in Python 2.x

root = Tk() Label(root, text="Hallo Welt!").pack() root.mainloop() </syntaxhighlight>

Q

QBasic

<syntaxhighlight lang="qbasic" highlight="1"> PRINT "Hallo Welt!" </syntaxhighlight>

R

R

<syntaxhighlight lang="bash" highlight="1"> print("Hallo Welt!") </syntaxhighlight>

mit der cat()-Funktion

<syntaxhighlight lang="bash" highlight="1"> cat("Hallo Welt!\n") </syntaxhighlight> oder mit der writeLines()-Funktion <syntaxhighlight lang="bash"> writeLines("Hallo Welt!") </syntaxhighlight>

Racket

<syntaxhighlight lang="racket" highlight="2">

  1. lang racket/base

"Hallo Welt!" </syntaxhighlight>

REXX

<syntaxhighlight lang="rexx" highlight="1"> say "Hallo Welt!" </syntaxhighlight>

Ruby

<syntaxhighlight lang="ruby" highlight="1"> puts "Hallo Welt!" </syntaxhighlight>

Ruby mit GTK

<syntaxhighlight lang="ruby" highlight="2"> require "gtk2" Gtk::Window.new("Hallo Welt!").show_all.signal_connect(:delete_event){Gtk.main_quit} Gtk.main </syntaxhighlight>

Ruby mit Tk

<syntaxhighlight lang="ruby" highlight="2"> require "tk" TkRoot.new{ title "Hallo Welt!" } Tk.mainloop </syntaxhighlight>

Rust

<syntaxhighlight lang="c" highlight="2"> fn main() {

 println!("Hallo Welt");

} </syntaxhighlight>

S

SAS

<syntaxhighlight lang="text" highlight="2"> data _null_;

  put "Hallo Welt!";

run; </syntaxhighlight>

oder (SAS Macro Language) <syntaxhighlight lang="text" highlight="1"> %put Hallo Welt!; </syntaxhighlight>

Scala

Als interpretierbares Skript: <syntaxhighlight lang="scala" highlight="2"> println("Hallo Welt!") </syntaxhighlight>

Unter Ausnutzung des Traits App als übersetzbare Datei:

<syntaxhighlight lang="scala" highlight="2"> object HalloWelt extends App {

 println("Hallo Welt!")

} </syntaxhighlight>

oder Java-ähnlich als übersetzbare Datei:

<syntaxhighlight lang="scala" highlight="3"> object HalloWelt {

 def main(args: Array[String]) {
   println("Hallo Welt!")
 }

} </syntaxhighlight>

Scheme

<syntaxhighlight lang="scheme" highlight="1"> (display "Hallo Welt!") (newline) </syntaxhighlight>

Seed7

<syntaxhighlight lang="html" highlight="5"> $ include "seed7_05.s7i";

const proc: main is func

 begin
   writeln("Hallo Welt!");
 end func;

</syntaxhighlight>

Smalltalk

Mit Enfin Smalltalk:

<syntaxhighlight lang="smalltalk" highlight="1"> 'Hallo Welt!' out. </syntaxhighlight>

Mit VisualWorks:

<syntaxhighlight lang="smalltalk" highlight="1"> Transcript show: 'Hallo Welt!'. </syntaxhighlight>

Spec#

<syntaxhighlight lang="csharp" highlight="7"> 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!");
   }

} </syntaxhighlight>

Standard ML

<syntaxhighlight lang="ocaml" highlight="1"> print "Hallo Welt!\n" </syntaxhighlight>

SQL

<syntaxhighlight lang="sql" highlight="1"> SELECT 'Hallo Welt!' AS message; </syntaxhighlight>

Für Oracle-Datenbanken, MySQL <syntaxhighlight lang="sql" highlight="1"> SELECT 'Hallo Welt!' FROM dual; </syntaxhighlight>

Für IBM-DB2 <syntaxhighlight lang="sql" highlight="1"> SELECT 'Hallo Welt!' FROM sysibm.sysdummy1; </syntaxhighlight>

Für MySQL, PostgreSQL, SQLite und MSSQL <syntaxhighlight lang="sql" highlight="1"> SELECT 'Hallo Welt!'; </syntaxhighlight>

StarOffice Basic

<syntaxhighlight lang="oobas" highlight="2"> sub main

 print "Hallo Welt!"

end sub </syntaxhighlight>

oder:

<syntaxhighlight lang="oobas" highlight="2"> sub HalloWeltAlternativ

   MsgBox "Hallo Welt!"

end sub </syntaxhighlight>

Swift

Swift 1.0: <syntaxhighlight lang="fsharp" highlight="1"> println("Hallo Welt!") </syntaxhighlight>

Swift 2.0: <syntaxhighlight lang="fsharp" highlight="1"> print("Hallo Welt!") </syntaxhighlight>

T

Tcl

<syntaxhighlight lang="tcl" highlight="1"> puts "Hallo Welt!" </syntaxhighlight>

Tcl/Tk

<syntaxhighlight lang="tcl" highlight="2"> package require Tk label .l -text "Hallo Welt" pack .l </syntaxhighlight>

XOTcl

<syntaxhighlight lang="tcl" highlight="2"> proc hello { puts "Hallo Welt!" } </syntaxhighlight>

TI-Basic

<syntaxhighlight lang="basic" highlight="1">

Disp "HELLO, WORLD!"

</syntaxhighlight>

Turing

<syntaxhighlight lang="bash" highlight="1"> put "Hallo Welt!" </syntaxhighlight>

U

Unix-Shell

<syntaxhighlight lang="bash" highlight="1"> echo 'Hallo Welt!' </syntaxhighlight>

V

Verilog

<syntaxhighlight lang="verilog" highlight="3"> module hallo_welt; initial begin

$display ("Hallo Welt!");
#10 $finish;

end endmodule </syntaxhighlight>

VHDL

<syntaxhighlight lang="vhdl" highlight="7"> 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; </syntaxhighlight>

Visual Basic, Visual Basic Script und Visual Basic for Applications

<syntaxhighlight lang="vbscript" highlight="1"> MsgBox "Hallo Welt!" </syntaxhighlight>

…alternativ über den Windows Script Host: <syntaxhighlight lang="vbscript" highlight="1"> WScript.Echo "Hallo Welt!" </syntaxhighlight>

Visual Basic .NET

Ausgabe in der Konsole: <syntaxhighlight lang="vbnet" highlight="3"> Module Module1

   Sub Main()
       Console.WriteLine("Hallo Welt!")
   End Sub

End Module </syntaxhighlight>

Ausgabe in einer Messagebox: <syntaxhighlight lang="vbnet" highlight="3"> Class Hallo

   Sub HalloWelt
      MsgBox("Hallo Welt!")
   End Sub

End Class </syntaxhighlight>

Siehe auch

Weblinks

[[b:{{#if:en|en:}}{{#if:List of hello world programs|List of hello world programs|Liste von Hallo-Welt-Programmen/Höhere Programmiersprachen}}|Wikibooks: {{#if:Auflistung von “Hello-World”-Programmen|Auflistung von “Hello-World”-Programmen|{{#if:List of hello world programs|List of hello world programs|Liste von Hallo-Welt-Programmen/Höhere Programmiersprachen}}}}]]{{#switch: 1

|1|= – Lern- und Lehrmaterialien |0|-= |X|x={{#switch: 0

      |0|4|10|12|14|100=}}

|#default= – {{{suffix}}}

}}{{#if: en| ({{#invoke:Multilingual|format|en|slang=!|shift=m}}) }}

{{#invoke:TemplatePar|check

  |opt= 1= 2= lang= suffix=
  |template=Vorlage:Wikibooks
  |cat=Wikipedia:Vorlagenfehler/Schwesterprojekt
  }}
[{{canonicalurl:Commons:Category:{{#if:Hello World|Hello World|Liste von Hallo-Welt-Programmen/Höhere Programmiersprachen}}|uselang=de}} Commons: {{#if:Screenshots und Grafiken zu Hello World|Screenshots und Grafiken zu Hello World|{{#if:Hello World|Hello World|{{#invoke:WLink|getArticleBase}}}}}}]{{#switch:1

|X|x= |0|-= |S|s= – Sammlung von Bildern |1|= – Sammlung von Bildern{{#if: 10

    | {{#switch: {{#invoke:TemplUtl|faculty|1}}/{{#invoke:TemplUtl|faculty|0}}
        |1/=  und Videos
        |1/1=, Videos und Audiodateien
        |/1=  und Audiodateien}}
    | , Videos und Audiodateien
  }}

|#default= – }}{{#if: Hello World

   | {{#ifeq: {{#invoke:Str|left|hello world|9}} 
       | category: 
| FEHLER: Ohne Category: angeben!}}}}

Vorlage:Wikidata-Registrierung

Einzelnachweise

<references />