Hello world/Text
From Rosetta Code
See also: User Output - graphical or User Output - stderr
[edit] ActionScript
trace("Goodbye, World!");
[edit] Ada
Works with: GCC version 4.1.2
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
Put_Line ("Goodbye, World!");
end Main;
[edit] Aikido
println ("Goodbye, World!")
[edit] ALGOL 68
main: (
printf($"Goodbye, World!"l$)
)
[edit] AmigaE
PROC main()
WriteF('Goodbye, World!\n')
ENDPROC
[edit] AppleScript
To show in Script Editor Result pane:
"Goodbye, World!"
To show in Script Editor Event Log pane: log "Goodbye, World!"
[edit] Argile
use std
print "Goodbye, World!"
compile with: arc hello_world.arg -o hello_world.c && gcc -o hello_world hello_world.c
[edit] AutoHotkey
script launched from windows explorer
DllCall("AllocConsole")
FileAppend, Goodbye`, World!, CONOUT$
FileReadLine, _, CONIN$, 1
scripts run from shell [requires Windows XP or higher; older Versions of Windows don“t have the "AttachConsole" function]
DllCall("AttachConsole", "int", -1)
FileAppend, Goodbye`, World!, CONOUT$
SendInput Goodbye, World{!}
[edit] AWK
BEGIN{print "Goodbye, World!"}
[edit] BASIC
Works with: BASICA
10 print "Goodbye World!"
Works with: QuickBasic version 4.5
PRINT "Goodbye, World!"
[edit] BCPL
GET "libhdr"
LET start() = VALOF
{ writef("Goodbye, World!")
RESULTIS 0
}
[edit] Befunge
0"!dlrow ,eybdooG">:v
^,_@
[edit] C
Works with: gcc version 4.0.1
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Goodbye, World!\n");
return 0;
}
Or:
int main(int argc, char **argv){
puts("Goodbye, World!");
return 0;
}
[edit] C#
Works with: Mono version 1.2 Works with: Visual C# version 2003
System.Console.WriteLine("Goodbye, World!");
[edit] C++
Works with: GCC version 4.1.2 Works with: Visual C++ version 2005
#include <iostream>
int main () {
std::cout << "Goodbye, World!" << std::endl;
return 0;
}
[edit] Chef
Hello World Souffle.
This recipe prints the immortal words "Hello world!", in a basically brute force way. It also makes a lot of food for one person.
Ingredients.
72 g haricot beans
101 eggs
108 g lard
111 cups oil
32 zucchinis
119 ml water
114 g red salmon
100 g dijon mustard
33 potatoes
Method.
Put potatoes into the mixing bowl. Put dijon mustard into the mixing bowl. Put lard into the mixing bowl. Put red salmon into the mixing bowl. Put oil into the mixing bowl. Put water into the mixing bowl. Put zucchinis into the mixing bowl. Put oil into the mixing bowl. Put lard into the mixing bowl. Put lard into the mixing bowl. Put eggs into the mixing bowl. Put haricot beans into the mixing bowl. Liquefy contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish.
Serves 1.
[edit] Clean
Start = "Goodbye, World!"
[edit] Clojure
(println "Goodbye, world!")
[edit] Common Lisp
(format t "Goodbye, world!~%")
[edit] D
import tango.io.Console
void main()
{
Cout("Goodbye, World!").newline;
}
[edit] dc
[Goodbye, World!]p
[edit] E
println("Goodbye, World!")
stdout.println("Goodbye, World!")
[edit] eC
class GoodByeApp : Application
{
void Main()
{
PrintLn("Goodbye, World!");
}
}
[edit] Efene
short version (without a function)
io.format("Goodbye, world~n")
complete version (put this in a file and compile it)
run = fn () {
io.format("Goodbye, world~n")
}
[edit] Erlang
io:format("Goodbye, world~n").
[edit] Factor
"Goodbye, world." print
[edit] Falcon
> "Goodbye, World!"
[edit] FALSE
"Goodbye, World!
"
[edit] Forth
." Goodbye, World!"
Or as a whole program:
: goodbye ( -- ) ." Goodbye, World!" CR ;
[edit] Fortran
Works with: F77 Simplest case - display using default formatting:
print *,"Goodbye, world"
Use explicit output format:
100 format (5X,A,"!")
print 100,"Goodbye, world"
Output to channels other than stdout goes like this:
write (89,100) "Goodbye, world"
uses the format given at label 100 to output to unit 89. If output unit with this number exists yet (no "OPEN" statement or processor-specific external unit setting), a new file will be created and the output sent there. On most UNIX/Linux systems that file will be named "fort.89".
[edit] F#
printfn "%s" "Goodbye, world"
or using .Net classes directly
System.Console.WriteLine("Goodbye, World!")
[edit] Go
package main
import "fmt"
func main() { fmt.Printf("Goodbye, World!\n") }
[edit] Haskell
main = putStrLn "Goodbye, world"
[edit] HicEst
WRITE() 'Goodbye, World!'
[edit] Icon
procedure main ()
write ( "Goodbye World" )
end
[edit] IDL
print,'Goodbye World'
[edit] Ioke
"Goodbye, World!" println
[edit] J
'Goodbye, World!'
Goodbye, World!
[data=. 'Goodbye, World!'
Goodbye, World!
data
Goodbye, World!
smoutput data
Goodbye, World!
[edit] Java
System.out.println("Goodbye, World!");
[edit] JavaScript
Works with: Firefox version 2.0
<script language="JavaScript">
document.write("Goodbye, World!");
</script>
Works with: NJS version 0.2.5 Works with: Rhino Works with: SpiderMonkey
print('Hello, World!');
Works with: JScript
WScript.Echo("Hello, World!");
[edit] Joy
"Goodbye, World!" putchars.
[edit] Lisaac
Works with: Lisaac version 0.13.1 You can print to standard output in Lisaac by calling STRING.print or INTEGER.print:
Section Header // The Header section is required.
+ name := GOODBYE; // Define the name of this object.
Section Public
- main <- ("Goodbye, World!\n".print;);
However, it may be more straightforward to use IO.print_string instead:
Section Header // The Header section is required.
+ name := GOODBYE2; // Define the name of this object.
Section Public
- main <- (IO.put_string "Goodbye, World!\n";);
[edit] Logo
Print includes a line feed:
print [Goodbye, world!]
Type does not:
type [Goodbye, world!]
[edit] LSE64
" Goodbye, World!" ,t nl
[edit] Lua
Works with: Lua version 5.1.1
print("Goodbye, World!")
or:
print "Goodbye, World!"
In Lua, parentheses are optional for function calls when there is only one argument and this argument is either a string or a table constructor.
[edit] M4
For the particular nature of m4, this is simply:
`Goodbye, World'
[edit] Mathematica
Print["Goodbye, World!"]
[edit] MAXScript
print "Goodbye, World!"
or:
format "%" "Goodbye, World!"
[edit] Metafont
message "Goodbye, World"; end
[edit] mIRC Scripting Language
Works with: mIRC
alias saygoodbye { echo -a Goodbye! }
[edit] Modula-3
MODULE Goodbye EXPORTS Main;
IMPORT IO;
BEGIN
IO.Put("Goodbye, World!\n");
END Goodbye.
[edit] MUMPS
Write "Goodbye, World.",!
[edit] newLISP
Works with: newLisp version 6.1 and after
(println "Goodbye, World!")
[edit] Nimrod
echo("Goodbye, World!")
[edit] Objective-C
Works with: GCC To print to stdout:
printf("Goodbye, World!");
To log a time-stamped message to the Console:
NSLog(@"Goodbye, World!");
[edit] OCaml
print_endline "Goodbye, World!"
[edit] Octave
disp("Goodbye, world");
Or, using C-style function printf:
printf("Goodbye, world\n");
[edit] Oz
In the REPL:
{System.showInfo "Goodbye, World!"}
As a complete program:
functor
import Application System
define
{System.showInfo "Goodbye, World!"}
{Application.exit 0}
end
[edit] Pascal
Works with: Free Pascal
program byeworld;
begin
writeln('Goodbye, World!');
end.
[edit] Perl
Works with: Perl version 5.8.8
print "Goodbye, World!\n";
Works with: Perl version 5.10.x Backported from Perl 6:
use feature 'say';
say 'Goodbye, World!';
[edit] Perl 6
say 'Goodbye, World!';
[edit] PDP-11 Assembly
Works with: UNIX version 7
This is tested on Unix v7 Prints "Goodbye, World!" to stdout:
.globl start
.text
start:
mov $1,r0
sys 4; outtext; outlen
sys 1
rts pc
.data
outtext: <Goodbye, World!\n>
outlen = . - outtext
[edit] PHP
echo "Goodbye, World!\n";
[edit] PicoLisp
(prinl "Goodbye, World!")
[edit] PL/I
display ('Goodbye world');
[edit] Prolog
:- write('Goodbye, World', nl).
[edit] Pop11
printf('Goodbye, World!\n');
[edit] Pike
int main(){
write("Goodbye, world!\n");
}
[edit] PostScript
The "==" and "=" operators display the topmost element of the stack with or without processing, followed by a newline. Thus:
(Goodbye, World!) ==
will display the string "(Goodbye, World!)" while
(Goodbye, World!) =
will display the content of the string "(Goodbye, World!)"; that is, "Goodbye, World!".
To print a string without the following newline, use
(Goodbye, World!) print
[edit] PowerShell
Write-Host "Goodbye, World!"
# For extra flair, you can specify colored output
Write-Host "Goodbye, World!" -foregroundcolor red
[edit] PureBasic
OpenConsole()
PrintN("Goodbye, World!")
Input() ; Wait for enter
[edit] Python
Works with: Python version 2.4
print "Goodbye, World!"
The same using sys.stdout
import sys
sys.stdout.write("Goodbye, World!\n")
In Python 3.0, print is being changed from a statement to a function.
Works with: Python version 3.0
print("Goodbye, World!")
[edit] R
cat("Goodbye, World!\n")
[edit] Raven
'Goodbye, World!' print
[edit] REBOL
print "Goodbye, World!"
[edit] REXX
/* goodbye program */
say 'Goodbye, World!'
[edit] Ruby
Works with: Ruby version 1.8.4
puts "Goodbye, World!"
or
$stdout.puts "Goodbye, World!"
[edit] sed
cGoodbye, World!
[edit] Seed7
$ include "seed7_05.s7i";
const proc: main is func
begin
writeln("Goodbye, World!");
end func;
[edit] Scheme
Works with: Gauche
(display "Goodbye, world!")
(newline)
or
(print "Goodbye, world!")
[edit] Slate
inform: 'Goodbye, world!'.
[edit] Smalltalk
Transcript show: 'Goodbye, world!'; cr.
Works with: GNU Smalltalk
'Goodbye, world!' printNl.
[edit] SNOBOL4
Using CSnobol4 dialect
OUTPUT = "Hello World"
END
[edit] SNUSP
@\G.@\o.o.@\d.--b.@\y.@\e.>@\comma.@\.<-@\W.+@\o.+++r.------l.@\d.>+.! #
| | \@------|# | \@@+@@++|+++#- \\ -
| \@@@@=+++++# | \===--------!\===!\-----|-------#-------/
\@@+@@@+++++# \!#+++++++++++++++++++++++#!/
[edit] Standard ML
print "Goodbye, World!\n"
[edit] Suneido
Print("Hello World!")
[edit] Transact-SQL
PRINT "Goodbye, world!"
[edit] Tcl
Output to terminal:
puts "Goodbye, World"
Output to arbitrary open, writable file:
puts $fileID "Goodbye, World"
[edit] TI-83 BASIC
See TI-89 BASIC.
[edit] TI-89 BASIC
Disp "Goodbye, World!"
[edit] UNIX Shell
Works with: Bourne Again SHell
#!/bin/bash
echo "Goodbye World!"
[edit] Unlambda
`r``````````````.G.o.o.d.b.y.e.,. .W.o.r.l.di
[edit] Ursala
output as a side effect of compilation
#show+
main = -[Goodbye, World!]-
output by a compiled executable
#import std
#executable ('parameterized','')
main = <file[contents: -[Goodbye, World!]-]>!
[edit] V
"Goodbye! world" puts
[edit] VBScript
Works with: Windows Script Host version 5.7
WScript.Echo("Goodbye, World!")
[edit] Vedit macro language
Message("Goodbye, World!")
[edit] X86 Assembly
Works with: nasm version 2.05.01
This is known to work on Linux, it may or may not work on other Unix-like systems
Prints "Goodbye, World!" to stdout (and there is probably an even simpler version):
section .data
msg db 'Goodbye, World!', 0AH
len equ $-msg
section .text
global _start
_start: mov edx, len
mov ecx, msg
mov ebx, 1
mov eax, 4
int 80h
mov ebx, 0
mov eax, 1
int 80h
[edit] XSLT
<xsl:text>Goodbye, World!
</xsl:text>
[edit] Quill
"Goodbye, World!" print







