Hello World (ALGOL 68)

From LiteratePrograms

Jump to: navigation, search
Other implementations: Ada | ALGOL 68 | Alice ML | Amiga E | Applescript | AspectJ | Assembly Intel x86 Linux | Assembly Intel x86 NetBSD | AWK | bash | BASIC | Batch files | C | C, Cairo | C, Xlib | Candle | Clojure | C++ | C# | Delphi | Dylan | E | Eiffel | Erlang | Forth | FORTRAN | Fortress | Go | Groovy | Haskell | Hume | IBM PC bootstrap | Inform 7 | Java | Java, Swing | JavaScript | LaTeX | Lisp | Logo | Lua | Maple | MATLAB | Mercury | OCaml/F Sharp | occam | Oz | Pascal | Perl | PHP | Pic | PIR | PLI | PostScript | Prolog | Python | Rexx | Ruby | Scala | Scheme | Seed7 | sh | Smalltalk | SQL | Standard ML | SVG | Tcl | Tcl Tk | Visual Basic | Visual Basic .NET | XSL

This short ALGOL 68 program prints a message to the console.

<<hello_world.a68>>=
main:
(
        printf($"Hello World!"l$)
)

The standard prelude provides the declaration for printf(). ALGOL 68 programs always enter at the beginning of of the code, the label "main" is optional, typically the "main:" label is replaced with jobcards for setting up the compilation, and running the job. No result is returned to the operating system, however in the standard "postclude" there is a "stop:" label available to stop the program early. We could use putf(stand out,(..)) instead of printf(...) in this simple example.

Download code
Views
Personal tools