Hello world/Text
You are encouraged to solve this task according to the task description, using any language you may know.
See also
- Hello world/Graphical
- Hello world/Line Printer
- Hello world/Newline omission
- Hello world/Standard error
- Hello world/Web server
[edit] 0815
<:47:x<:6F:=<:64:$=$$=$
<:62:x<:79:=<:65:$=$=$
<:2C:x<:20:=<:57:$=$=$
<:6F:x<:72:=<:6C:$=$=$
<:64:x<:21:=<:0D:$=$=$
[edit] 360 Assembly
{using native SVC (Supervisor Call) to write to system console}
LA 1,MSGAREA Point Register 1 to message area
SVC 35 Invoke SVC 35 (Write to Operator)
BR 14 Return
MSGAREA EQU * Message Area
DC AL2(19) Total area length = 19 (Prefix length:4 + Data Length:15)
DC XL2'00' 2 bytes binary of zeros
DC C'Goodbye, World!' Text to be written to system console
END
{using WTO Macro to generate SVC 35 and message area}
WTO 'Goodbye, World!'
BR 14 Return
END
[edit] 4DOS Batch
echo Goodbye, World!
[edit] 6502 Assembly
; goodbyeworld.s for C= 8-bit machines, ca65 assembler format.
; String printing limited to strings of 256 characters or less.
a_cr = $0d ; Carriage return.
bsout = $ffd2 ; KERNAL ROM, output a character to current device.
.code
ldx #0 ; Starting index 0 in X register.
printnext:
lda text,x ; Get character from string.
beq done ; If we read a 0 we're done.
jsr bsout ; Output character.
inx ; Increment index to next character.
bne printnext ; Repeat if index doesn't overflow to 0.
done:
rts ; Return from subroutine.
.rodata
text:
.byte "Goodbye, World!", a_cr, 0
[edit] 6800 Assembly
.cr 6800
.tf gbye6800.obj,AP1
.lf gbye6800
;=====================================================;
; Goodbye, World! for the Motorola 6800 ;
; by barrym 2013-03-17 ;
;-----------------------------------------------------;
; Prints the message "Goodbye, World!" to an ascii ;
; terminal (console) connected to a 1970s vintage ;
; SWTPC 6800 system, which is the target device for ;
; this assembly. ;
; Many thanks to: ;
; swtpc.com for hosting Michael Holley's documents! ;
; sbprojects.com for a very nice assembler! ;
; swtpcemu.com for a very capable emulator! ;
; reg x is the string pointer ;
; reg a holds the ascii char to be output ;
;-----------------------------------------------------;
outeee = $e1d1 ROM: console putchar routine
.or $0f00
;-----------------------------------------------------;
main ldx #string Point to the string
bra puts and print it
outs jsr outeee Emit a as ascii
inx Advance the string pointer
puts ldaa ,x Load a string character
bne outs Print it if non-null
swi else return to the monitor
;=====================================================;
string .as "Goodbye, World!",#13,#10,#0
.en
[edit] 8086 Assembly
DOSSEG
.MODEL TINY
.DATA
TXT DB "Goodbye, World!$"
.CODE
START:
MOV ax, @DATA
MOV ds, ax
MOV ah, 09h ; prepare output function
MOV dx, OFFSET TXT ; set offset
INT 21h ; output string TXT
MOV AX, 4C00h ; go back to DOS
INT 21h
END START
With A86 or NASM syntax:
org 100h mov dx, msg mov ah, 9 int 21h mov ax, 4c00h int 21h msg: db "Goodbye, World!$"
[edit] ABAP
REPORT zgoodbyeworld.
WRITE 'Goodbye, World!'.
[edit] ACL2
(cw "Goodbye, World!~%")
[edit] ActionScript
trace("Goodbye, World!");
[edit] Ada
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
Put_Line ("Goodbye, World!");
end Main;
[edit] GLBasic
STDOUT "GOODBYE, WORLD!"
[edit] Aime
o_text("GOODBYE, WORLD!\n");
or:
integer
main(void)
{
o_text("GOODBYE, WORLD!\n");
return 0;
}
[edit] Algae
printf("Goodbye, World\n");
[edit] ALGOL 68
main: (
printf($"Goodbye, World!"l$)
)
[edit] Alore
Print('Goodbye, World!')
[edit] AmbientTalk
system.println("Goodbye, World!")
[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] Applesoft BASIC
Important Note: Although Applesoft BASIC allowed the storage and output of mixed-case strings, the ability to enter mixed-case via the keyboard and to output mixed-case on the default display was not offered as standard equipment on the original Apple II/II+. Since Applesoft WAS the default programming language for the Apple II+, perhaps some flexibility in the task specification could be offered, for this and for other systems that lacked proper mixed-case I/O capabilities in at least one popular configuration.
PRINT "GOODBYE, WORLD!"
[edit] Apricot
(puts "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] Asymptote
write('Goodbye, World!');
[edit] ATS
implement main () = print "Goodbye, World!\n"
[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] AutoIt
ConsoleWrite("Goodbye, World!" & @CRLF)
[edit] AWK
BEGIN{print "Goodbye, World!"}
"BEGIN" is a "special pattern" - code within "{}" is executed before the input file is read, even if there is no input. "END" is a similar pattern, for after completion of main processing.
END {
print "Goodbye, World!"
}
For a file containing data, the work can be done in the "body". The "//" is "match anything" so gets the first data, the "exit" halts processing the file (any "END" would then be executed).
// {
print "Goodbye, World!"
exit
}
For a "single record" file.
// {
print "Goodbye, World!"
}
For a "single record" file containing - Goodbye, World! -. The "default" action for a "pattern match" (the "/" and "/" define a "pattern" to match data) is to "print" the record.
//
[edit] Babel
main: { "Goodbye, World!" << }
[edit] BASIC
10 PRINT "Goodbye, World!"
PRINT "Goodbye, World!"
[edit] BASIC256
PRINT "Goodbye, World!"
[edit] Batch File
Under normal circumstances, when delayed expansion is disabled
echo Goodbye, World!
If delayed expansion is enabled, then the ! must be escaped twice
setlocal enableDelayedExpansion
echo Goodbye, World^^^!
[edit] BBC BASIC
PRINT "Goodbye, World!"
[edit] bc
"Goodbye, World!
"
[edit] BCPL
GET "libhdr"
LET start() = VALOF
{ writef("Goodbye, World!")
RESULTIS 0
}
[edit] Befunge
0"!dlroW ,eybdooG">:#,_@
[edit] Blast
# This will display a goodbye message on the terminal screen
.begin
display "Goodbye, World!"
return
# This is the end of the script.
[edit] Boo
print "Goodbye, World!"
[edit] Brace
#!/usr/bin/env bx
use b
Main:
say("Goodbye, World!")
[edit] Brainf***
We wanna make a series of round numbers going like:
10 close to newline and carriage return 30 close to ! and SPACE 40 close to COMMA 70 close to G 80 close to W 90 close to b 100 is d and close to e and l 110 close to o 120 close to y
forming all the letters we need if we just add up a bit
Commented version:
+++++ +++++ First cell 10 (its a counter and we will be "multiplying")
[
>+ 10 times 1 is 10
>+++ 10 times 3 is 30
>++++ etc etc
>+++++ ++
>+++++ +++
>+++++ ++++
>+++++ +++++
>+++++ ++++++
>+++++ +++++++
<<<<<<<<< - go back to counter and subtract 1
]
printing G
>>>> + .
o twice
>>>> + ..
d
< .
b
< +++++ +++ .
y
>>> + .
e
<< + .
COMMA
<<<< ++++ .
SPACE
< ++ .
W
>>> +++++ ++ .
o
>>> .
r
+++ .
l
< +++++ ++ .
d
----- --- .
!
<<<<< + .
CRLF
< +++ . --- .
Uncommented:
++++++++++[>+>+++>++++>+++++++>++++++++>+++++++++>++
++++++++>+++++++++++>++++++++++++<<<<<<<<<-]>>>>+.>>>
>+..<.<++++++++.>>>+.<<+.<<<<++++.<++.>>>+++++++.>>>.+++.
<+++++++.--------.<<<<<+.<+++.---.
It can most likely be optimized, but this is a nice way to show how character printing works in Brainf*** :)
[edit] Bracmat
put$"Goodbye, World!"
[edit] Brat
p "Goodbye, World!"
[edit] Brlcad
The mged utility can output text to the terminal:
echo Goodbye, World!
[edit] Burlesque
"Goodbye, World!"sh
Although please note that sh actually does not print anything.
[edit] C
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
printf("Goodbye, World!\n");
return EXIT_SUCCESS;
}
Or:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
puts("Goodbye, World!");
return EXIT_SUCCESS;
}
[edit] C#
System.Console.WriteLine("Goodbye, World!");
[edit] C++
#include <iostream>
int main () {
std::cout << "Goodbye, World!" << std::endl;
return std::cout.bad();
}
[edit] C++/CLI
using namespace System;
int main()
{
Console::WriteLine("Goodbye, World!");
}
[edit] C1R
A small Hello World program, that lists the significant part of the related task URL at the Rosetta Code web site
Hello_world/Text
[edit] Cat
"Goodbye, World!" writeln
[edit] Cduce
print "Goodbye, World!";;
[edit] Chef
Goodbye World Souffle.
Ingredients.
71 g green beans
111 cups oil
98 g butter
121 ml yogurt
101 eggs
44 g wheat flour
32 zucchinis
119 ml water
114 g red salmon
108 g lard
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 wheat flour into the mixing bowl.
Put eggs into the mixing bowl.
Put yogurt into the mixing bowl.
Put butter into the mixing bowl.
Put dijon mustard into the mixing bowl.
Put oil into the mixing bowl.
Put oil into the mixing bowl.
Put green beans into the mixing bowl.
Liquefy contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.
Serves 1.
[edit] Clay
main() {
println("Goodbye, World!");
}
[edit] Clean
Start = "Goodbye, World!"
[edit] CLIPS
(printout t "Goodbye, World!" crlf)
[edit] Clojure
(println "Goodbye, World!")
[edit] CMake
message(STATUS "Goodbye, World!")
This outputs
-- Goodbye, World!
[edit] COBOL
Using fixed format.
program-id. hello.
procedure division.
display "Goodbye, World!".
stop run.
[edit] Cobra
class Hello
def main
print 'Goodbye, World!'
[edit] CoffeeScript
console.log "Goodbye, World!"
[edit] ColdFusion
<cfoutput>Goodbye, World!</cfoutput>
[edit] Common Lisp
(format t "Goodbye, World!~%")
[edit] Component Pascal
MODULE Hello;
IMPORT Out;
PROCEDURE Do*;
BEGIN
Out.String("Goodbye, World!"); Out.Ln
END Do;
END Hello.
Run command Hello.Do by commander.
[edit] Crack
import crack.io cout;
cout `Goodbye, World!\n`;
[edit] Creative Basic
OPENCONSOLE
PRINT"Goodbye, World!"
'This line could be left out.
PRINT:PRINT:PRINT"Press any key to end."
'Keep the console from closing right away so the text can be read.
DO:UNTIL INKEY$<>""
CLOSECONSOLE
END
[edit] D
import std.stdio;
void main() {
writeln("Goodbye, World!");
}
[edit] Dao
io.writeln( 'Goodbye, World!' )
[edit] Dart
main() {
var bye = 'Goodbye, World!';
print("$bye");
}
[edit] dc
[Goodbye, World!]p
[edit] Déjà Vu
print "Goodbye, World!"
[edit] Delphi
program ProjectGoodbye;
{$APPTYPE CONSOLE}
begin
WriteLn('Goodbye, World!');
end.
[edit] DWScript
PrintLn('Goodbye, World!');
[edit] Dylan
module: hello-world
format-out("%s\n", "Goodbye, World!");
[edit] Dylan.NET
One Line version:
Console::WriteLine("Goodbye, World!")
Hello World Program:
//compile using the new dylan.NET v, 11.2.8.2 or later
//use mono to run the compiler
#refstdasm mscorlib.dll
import System
assembly helloworld exe
ver 1.2.0.0
class public auto ansi Module1
method public static void main()
Console::WriteLine("Goodbye, World!")
end method
end class
[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)
@public
run = fn () {
io.format("Goodbye, World!~n")
}
[edit] Eiffel
| This page uses content from Wikipedia. The original article was at Eiffel (programming language). The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) |
class
HELLO_WORLD
create
make
feature
make
do
print ("Goodbye, World!%N")
end
end
[edit] Ela
open console
writen "Goodbye, World!"
[edit] elastiC
From the elastiC Manual.
package hello;
// Import the `basic' package
import basic;
// Define a simple function
function hello()
{
// Print hello world
basic.print( "Goodbye, World!\n" );
}
/*
* Here we start to execute package code
*/
// Invoke the `hello' function
hello();
[edit] Elena
#symbol Program =
[
'program'output << "Goodbye, World!%n".
].
[edit] Elena VM Script
sys'vm'routines'dummy "Goodbye, World!" %write &nil 'program'output &wrapbatch[4]
%get &nil 'program'input &wrapbatch[2]
&cast[2]
&nil
^eval
[edit] Elisa
"Goodbye, World!"?
[edit] Emacs Lisp
(insert "Goodbye, World!")
[edit] Erlang
io:format("Goodbye, World!~n").
[edit] Euphoria
puts(1,"Goodbye, World!\n")
[edit] EGL
program HelloWorld
function main()
SysLib.writeStdout("Goodbye, World!");
end
end
[edit] Euler Math Toolbox
"Hello World!"
[edit] F#
printfn "%s" "Goodbye, World!"
or using .Net classes directly
System.Console.WriteLine("Goodbye, World!")
[edit] Factor
"Goodbye, World!" print
[edit] Falcon
> "Goodbye, World!"
[edit] FALSE
"Goodbye, World!
"
[edit] Fantom
class HelloText
{
public static Void main ()
{
echo ("Goodbye, World!")
}
}
[edit] ferite
word.}}
uses "console";
Console.println( "Goodby, World!" );
[edit] Fexl
print "Goodbye, World!";nl;
[edit] Fish
Standard Hello, world example, modified for this task:
!v"Goodbye, World!"r!
>l?!;o
Explanation of the code:
!v" jumps over the v character with the ! sign, then starts the string mode with " .
Then the characters Goodbye, World! are added, and string mode is closed with ".
The stack is reversed for printing (r), and a jump (!) is executed to jump over the ! at the beginning of the line and execute the v. (Fish is torical)
After going down by v, it goes rightwards again by > and this line is being executed.
This line pushes the stack size (l), and stops (;) if the top item on the stack is equal to 0 (?). Else it executes the ! directly after it and jumps to the o, which outputs the top item in ASCII. Then the line is executed again. It effectively prints the stack until it's empty, then it terminates.
[edit] Forth
." Goodbye, World!"
Or as a whole program:
: goodbye ( -- ) ." Goodbye, World!" CR ;
[edit] Fortran
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] Fortress
export Executable
run() = println("Goodbye, World!")
[edit] Frege
module HelloWorld where
main _ = println "Goodbye, World!"
[edit] friendly interactive shell
Unlike other UNIX shell languages, fish doesn't support history substitution, so ! is safe to use without quoting.
echo Goodbye, World!
[edit] Frink
println["Goodbye, World!"]
[edit] Gambas
PRINT "Goodbye, World!"
[edit] GAP
# Several ways to do it
"Goodbye, World!";
Print("Goodbye, World!\n"); # No EOL appended
Display("Goodbye, World!");
f := OutputTextUser();
WriteLine(f, "Goodbye, World!\n");
CloseStream(f);
[edit] gecho
'Goodbye, <> 'World! print
[edit] Gema
Gema ia a preprocessor that reads an input file and writes an output file. This code will write "Goodbye, World!' no matter what input is given.
*= ! ignore off content of input
\B=Goodbye, World\! ! Start output with this text.
[edit] Glee
"Goodbye, World!"
[edit] Go
package main
func main() { println("Goodbye, World!") }
[edit] Golfscript
"Goodbye, World!"
[edit] Gosu
print("Goodbye, World!")
[edit] Groovy
println "Goodbye, World!"
[edit] GW-BASIC
10 PRINT "Goodbye, World!"
[edit] Haskell
main = putStrLn "Goodbye, World!"
[edit] HicEst
WRITE() 'Goodbye, World!'
[edit] HLA
program goodbyeWorld;
#include("stdlib.hhf")
begin goodbyeWorld;
stdout.put( "Goodbye, World!" nl );
end goodbyeWorld;
[edit] HQ9+
H
- Technically, HQ9+ can't print "Goodbye, world!" text because of its specification.
- H : Print 'Hello World!'
- Q : Quine
- 9 : Print '99 Bottles of Beer'
- + : Increase Pointer (useless!)
[edit] Icon and Unicon
procedure main()
write( "Goodbye, World!" )
end
[edit] IDL
print,'Goodbye, World!'
[edit] Inform 6
[Main;
print "Goodbye, World!^";
];
[edit] Integer BASIC
NOTE: Integer BASIC was written (and hand-assembled by Woz himself) for the Apple 1 and original Apple 2. The Apple 1 has NO support for lower-case letters, and it was an expensive (and later) option on the Apple 2. This example accurately represents the only reasonable solution for those target devices, and therefore cannot be "fixed", only deleted.
10 PRINT "GOODBYE, WORLD!"
20 END
[edit] Io
"Goodbye, World!" println
[edit] Ioke
"Goodbye, World!" println
[edit] IWBASIC
OPENCONSOLE
PRINT"Goodbye, World!"
'This line could be left out.
PRINT:PRINT:PRINT"Press any key to end."
'Keep the console from closing right away so the text can be read.
DO:UNTIL INKEY$<>""
CLOSECONSOLE
END
[edit] J
'Goodbye, World!'
Goodbye, World!
Here are some redundant alternatives:
[data=. 'Goodbye, World!'
Goodbye, World!
data
Goodbye, World!
smoutput data
Goodbye, World!
[edit] Java
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Goodbye, World!");
}
}
[edit] Jacquard Loom
This weaves the string "Goodbye, World!"
+---------------+
| |
| * * |
|* * * * |
|* * *|
|* * *|
|* * * |
| * * * |
| * |
+---------------+
+---------------+
| |
|* * * |
|* * * |
| * *|
| * *|
|* * * |
|* * * * |
| * |
+---------------+
+---------------+
| |
|* ** * * |
|******* *** * |
| **** * * ***|
| **** * ******|
| ****** ** * |
| * * * * |
| * |
+---------------+
+---------------+
| |
|******* *** * |
|******* *** * |
| ** *|
|* * * *|
|******* ** * |
|******* *** * |
| * |
+---------------+
+---------------+
| |
|******* *** * |
|******* *** * |
| * * * *|
| * * * *|
|******* ** * |
|******* ** * |
| * |
+---------------+
+---------------+
| |
|***** * *** * |
|******* *** * |
| * * * * |
| * * * |
|****** ** * |
|****** ** * |
| * |
+---------------+
+---------------+
| |
| * * * |
|***** * ***** |
|***** ** * ***|
|***** ** * ***|
|******* * ** |
| * * * * |
| * |
+---------------+
+---------------+
| |
| |
| * * |
| * * |
| * |
| * |
| |
| |
+---------------+
[edit] JavaScript
document.write("Goodbye, World!");
print('Goodbye, World!');
WScript.Echo("Goodbye, World!");
console.log("Goodbye, World!")
[edit] JCL
/*MESSAGE Goodbye, World!
[edit] Joy
"Goodbye, World!" putchars.
[edit] Julia
print("Goodbye, World!")
[edit] Kaya
program hello;
Void main() {
// My first program!
putStrLn("Goodbye, World!");
}
[edit] Kdf9 Usercode
V2; W0;
RESTART; J999; J999;
PROGRAM; (main program);
V0 = Q0/AV1/AV2;
V1 = B0750064554545700; ("Hello" in Flexowriter code);
V2 = B0767065762544477; ("World" in Flexowriter code);
V0; =Q9; POAQ9; (write "Hello World" to Flexowriter);
999; OUT;
FINISH;
[edit] Kite
simply a single line
"#!/usr/local/bin/kite
"Goodbye, World!"|print;
[edit] KonsolScript
Displays it in a text file or console/terminal.
function main() {
Konsol:Log("Goodbye, World!")
}
[edit] Lang5
"Goodbye, World!\n" .
[edit] Liberty BASIC
print "Goodbye, World!"
[edit] Limbo
implement Command;
include "sys.m";
sys: Sys;
include "draw.m";
include "sh.m";
init(nil: ref Draw->Context, nil: list of string)
{
sys = load Sys Sys->PATH;
sys->print("Goodby, World!\n");
}
[edit] Lisaac
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] Logtalk
:- object(hello_world).
% the initialization/1 directive argument is automatically executed
% when the object is loaded into memory:
:- initialization((nl, write('Goodbye, World!'), nl)).
:- end_object.
[edit] LOLCODE
HAI
CAN HAS STDIO?
VISIBLE "Goodbye, World!"
KTHXBYE
[edit] LotusScript
:- object(hello_world).
'This will send the output to the status bar at the bottom of the Notes client screen
print "Goodbye, World!"
:- end_object.
[edit] LSE64
"Goodbye, World!" ,t nl
[edit] Lua
Function calls with either a string literal or a table constructor passed as their only argument do not require parentheses.
print "Goodbye, World!"
[edit] M4
For the particular nature of m4, this is simply:
`Goodbye, World!'
[edit] Maple
> printf( "Goodbye, World!\n" ): # print without quotes
Goodbye, World!
[edit] Mathematica
Print["Goodbye, World!"]
[edit] MATLAB
>> 'Goodbye, World!'
ans =
Goodbye, World!
[edit] Maxima
print("Goodbye, World!");
[edit] MAXScript
print "Goodbye, World!"
or:
format "%" "Goodbye, World!"
[edit] Mercury
:- module hello.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
main(!IO) :-
io.write_string("Goodbye, World!\n", !IO).
[edit] Metafont
message "Goodbye, World!"; end
[edit] MIPS Assembly
and.data
hello: .asciiz "Goodbye, World!"
.text
main:
la $a0, hello
li $v0, 4
syscall
li $v0, 10
syscall
[edit] mIRC Scripting Language
echo -ag Goodbye, World!
[edit] ML/I
Goodbye, World!
[edit] Modula-2
MODULE Hello;
IMPORT InOut;
BEGIN
InOut.WriteString('Goodbye, World!');
InOut.WriteLn
END Hello.
[edit] Modula-3
MODULE Goodbye EXPORTS Main;
IMPORT IO;
BEGIN
IO.Put("Goodbye, World!\n");
END Goodbye.
[edit] MUF
: main[ -- ]
me @ "Goodbye, World!" notify
exit
;
[edit] MUMPS
Write "Goodbye, World!",!
[edit] Mythryl
print "Goodbye, World!";
[edit] Neat
void main() writeln "Goodbye, World!";
[edit] Nemerle
class Hello
{
static Main () : void
{
System.Console.WriteLine ("Goodbye, World!");
}
}
Easier method:
System.Console.WriteLine("Goodbye, World!");
[edit] NetRexx
say 'Goodbye, World!'
[edit] newLISP
(println "Goodbye, World!")
[edit] Nimrod
echo("Goodbye, World!")
[edit] Node.js
console.log("Goodbye, World!");
[edit] Oberon-2
MODULE Goodbye;
IMPORT Out;
PROCEDURE World*;
BEGIN
Out.String("Goodbye, World!");Out.Ln
END World;
BEGIN
World;
END Goodbye.
[edit] Objeck
class Hello {
function : Main(args : String[]) ~ Nil {
"Goodbye, World!"->PrintLine();
}
}
[edit] Objective-C
To print to stdout:
printf("Goodbye, World!");
To print an Objective-C NSString to stdout, here are some options:
printf("%s", [@"Goodbye, World!" UTF8String]);
[@"Goodbye, World!" writeToFile:@"/dev/stdout" atomically:NO encoding:NSUTF8StringEncoding error:NULL];
[[NSFileHandle fileHandleWithStandardOutput] writeData:[@"Goodbye, World!" dataUsingEncoding:NSUTF8StringEncoding]];
To log a time-stamped message to stderr:
NSLog(@"Goodbye, World!");
[edit] OCaml
print_endline "Goodbye, World!"
[edit] Occam
#USE "course.lib"
PROC main (CHAN BYTE screen!)
out.string("Goodbye, World!*c*n", 0, screen)
:
[edit] Octave
disp("Goodbye, World!");
Or, using C-style function printf:
printf("Goodbye, World!");
[edit] Onyx
`Goodbye, World!\n' print
[edit] OOC
main: func {
"Goodbye, World!" println()
}
[edit] ooRexx
Refer also to the Rexx and NetRexx solutions. Simple output is common to most Rexx dialects.
/* Rexx */
say 'Goodbye, World!'
[edit] Openscad
echo("Goodbye, World!");
[edit] Oxygene
From wp:Oxygene (programming language)
namespace HelloWorld;
interface
type
HelloClass = class
public
class method Main;
end;
implementation
class method HelloClass.Main;
begin
System.Console.WriteLine('Goodbye, World!');
end;
end.
>HelloWorld.exe Goodbye, World!
[edit] Oz
{Show "Goodbye, World!"}
[edit] PARI/GP
print("Goodbye, World!")
[edit] Pascal
program byeworld;
begin
writeln('Goodbye, World!');
end.
[edit] PASM
print "Goodbye, World!\n"
end
[edit] PDP-11 Assembly
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] Perl
print "Goodbye, World!\n";
Backported from Perl 6:
use feature 'say';
say 'Goodbye, World!';
or:
use 5.010;
say 'Goodbye, World!';
[edit] Perl 6
say 'Goodbye, World!';
[edit] PHP
<?php
echo "Goodbye, World!\n";
?>
Alternatively, any text outside of the <?php ?> tags will be automatically echoed:
Goodbye, World!
[edit] PicoLisp
(prinl "Goodbye, World!")
[edit] PIR
.sub hello_world_text :main
print "Goodbye, World!\n"
.end
[edit] Pike
int main(){
write("Goodbye, World!\n");
}
[edit] PL/I
put ('Goodbye, World!');
[edit] Pop11
printf('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] ProDOS
printline Goodbye, World!
[edit] Prolog
:- write('Goodbye, World!'), nl.
[edit] PSQL
EXECUTE BLOCK RETURNS(S VARCHAR(40)) AS BEGIN S = 'Goodbye, World!'; SUSPEND; END
[edit] Pure
using system;
puts "Goodbye, World!\n" ;
[edit] PureBasic
OpenConsole()
PrintN("Goodbye, World!")
Input() ; Wait for enter
[edit] Python
print "Goodbye, World!"
The same using sys.stdout
import sys
sys.stdout.write("Goodbye, World!\n")
In Python 3.0, print is changed from a statement to a function.
(And version 2.X too).print("Goodbye, World!")
[edit] Quill
"Goodbye, World!" print
[edit] R
cat("Goodbye, World!\n")
[edit] Racket
(printf "Goodbye, World!\n")
[edit] Raven
'Goodbye, World!' print
[edit] REALbasic
This requires a console application.
Function Run(args() as String) As Integer
Print "Goodbye, World!"
Quit
End Function
[edit] REBOL
print "Goodbye, World!"
[edit] Retro
"Goodbye, World!" puts
[edit] REXX
[edit] using SAY
/*REXX program to show a line of text. */
say 'Goodbye, World!'
[edit] using SAY variable
/*REXX program to show a line of text. */
yyy = 'Goodbye, World!'
say yyy
[edit] using LINEOUT
/*REXX program to show a line of text. */
call lineout ,"Goodbye, World!"
[edit] RTL/2
TITLE Goodbye World;
LET NL=10;
EXT PROC(REF ARRAY BYTE) TWRT;
ENT PROC INT RRJOB();
TWRT("Goodbye, World!#NL#");
RETURN(1);
ENDPROC;
[edit] Ruby
puts "Goodbye, World!"
or
$stdout.puts "Goodbye, World!"
[edit] Run BASIC
print "Goodbye, World!"
[edit] Rust
fn main() {
io::println("Goodbye, World!");
}
[edit] Salmon
"Goodbye, World!"!
or
print("Goodbye, World!\n");
or
standard_output.print("Goodbye, World!\n");
[edit] SAS
/* Using a data step. Will print the string in the log window */
data _null_;
put "Goodbye, World!";
run;
[edit] Sather
class GOODBYE_WORLD is
main is
#OUT+"Goodbye, World!\n";
end;
end;
[edit] Scala
println("Goodbye, World!")
[edit] Scheme
(display "Goodbye, World!")
(newline)
(print "Goodbye, World!")
or just:
"Goodbye, World!"
(should work on any scheme)
[edit] sed
cGoodbye, World!
[edit] Seed7
$ include "seed7_05.s7i";
const proc: main is func
begin
writeln("Goodbye, World!");
end func;
[edit] Self
'Goodbye, World!' printLine.
[edit] Shiny
say 'Goodbye, World!'
[edit] SIMPOL
function main()
end function "Goodbye, World!{d}{a}"
[edit] Sisal
define main
% Sisal doesn't yet have a string built-in.
% Let's define one as an array of characters.
type string = array[character];
function main(returns string)
"Goodbye, World!"
end function
[edit] Slate
inform: 'Goodbye, World!'.
[edit] Smalltalk
Transcript show: 'Goodbye, World!'; cr.(as does the above code)
'Goodbye, World!' printNl.
[edit] SNOBOL4
Using CSnobol4 dialect
OUTPUT = "Goodbye, World!"
END
[edit] SNUSP
[edit] Core SNUSP
/++++!/===========?\>++.>+.+++++++..+++\
\+++\ | /+>+++++++>/ /++++++++++<<.++>./
$+++/ | \+++++++++>\ \+++++.>.+++.-----\
\==-<<<<+>+++/ /=.>.+>.--------.-/
[edit] Modular SNUSP
@\G.@\o.o.@\d.--b.@\y.@\e.>@\comma.@\.<-@\W.+@\o.+++r.------l.@\d.>+.! #
| | \@------|# | \@@+@@++|+++#- \\ -
| \@@@@=+++++# | \===--------!\===!\-----|-------#-------/
\@@+@@@+++++# \!#+++++++++++++++++++++++#!/
[edit] Standard ML
print "Goodbye, World!\n"
[edit] Suneido
Print("Goodbye, World!")
[edit] Teco
Outputting to terminal. Please note that ^A means control-A, not a caret followed by 'A', and that $ represent the ESC key.
^AGoodbye, World!^A$$
[edit] Tcl
Output to terminal:
puts "Goodbye, World!"
Output to arbitrary open, writable file:
puts $fileID "Goodbye, World!"
[edit] TestML
%TestML 0.1.0
Print("Goodbye, World!")
[edit] TI-83 BASIC
See TI-89 BASIC.
[edit] TI-89 BASIC
Disp "Goodbye, World!"
[edit] TorqueScript
echo("Goodbye, World!");
[edit] Transact-SQL
PRINT "Goodbye, World!"
[edit] Trith
"Goodbye, World!" print
[edit] TPP
Goodbye, World!
[edit] TUSCRIPT
$$ MODE TUSCRIPT
PRINT "Goodbye, World!"
Output:
Goodbye, World!
[edit] UNIX Shell
#!/bin/sh
echo "Goodbye, World!"
[edit] C Shell
#!/bin/csh -f
echo "Goodbye, World\!"
We use \! to prevent history substitution. Plain ! at end of string seems to be safe, but we use \! to be sure.
[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] Vala
void main(){
stdout.printf("Goodbye, World!\n");
}
[edit] VBScript
WScript.Echo("Goodbye, World!")
[edit] Vedit macro language
Message("Goodbye, World!")
[edit] VHDL
LIBRARY std;
USE std.TEXTIO.all;
entity test is
end entity test;
architecture beh of test is
begin
process
variable line_out : line;
begin
write(line_out, string'("Goodbye, World!"));
writeline(OUTPUT, line_out);
wait; -- needed to stop the execution
end process;
end architecture beh;
[edit] Whenever
1 print("Goodbye, World!");
[edit] X86 Assembly
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] XL
use XL.UI.CONSOLE
WriteLn "Goodbye, World!"
[edit] XPL0
code Text=12;
Text(0, "Goodbye, World!
")
[edit] XSLT
<xsl:text>Goodbye, World!
</xsl:text>
[edit] Yorick
write, "Goodbye, World!"
[edit] Z80 Assembly
Using the Amstrad CPC firmware:
org $4000
txt_output: equ $bb5a
push hl
ld hl,world
print: ld a,(hl)
cp 0
jr z,end
call txt_output
inc hl
jr print
end: pop hl
ret
world: defm "Goodbye, World!\r\n\0"
- Programming Tasks
- Basic language learning
- Selection/Short Circuit/Console Program Basics
- 0815
- 360 Assembly
- 4DOS Batch
- 6502 Assembly
- 6800 Assembly
- 8086 Assembly
- ABAP
- ACL2
- ActionScript
- Ada
- GLBasic
- Aime
- Algae
- ALGOL 68
- Alore
- AmbientTalk
- AmigaE
- AppleScript
- Applesoft BASIC
- Apricot
- Argile
- Asymptote
- ATS
- AutoHotkey
- AutoIt
- AWK
- Babel
- BASIC
- BASIC256
- Batch File
- BBC BASIC
- Bc
- BCPL
- Befunge
- Blast
- Boo
- Brace
- Brainf***
- Bracmat
- Brat
- Brlcad
- Burlesque
- C
- C sharp
- C++
- C++/CLI
- C1R
- C1H examples needing attention
- Examples needing attention
- Cat
- Cduce
- Chef
- Clay
- Clean
- CLIPS
- Clojure
- CMake
- COBOL
- Cobra
- CoffeeScript
- ColdFusion
- Common Lisp
- Component Pascal
- Crack
- Creative Basic
- D
- Dao
- Dart
- Dc
- Déjà Vu
- Delphi
- DWScript
- Dylan
- Dylan.NET
- E
- EC
- Efene
- Eiffel
- WikipediaSourced
- Ela
- ElastiC
- Elena
- Elisa
- Emacs Lisp
- Erlang
- Euphoria
- EGL
- Euler Math Toolbox
- F Sharp
- Factor
- Falcon
- FALSE
- Fantom
- Ferite
- Fexl
- Fish
- Forth
- Fortran
- Fortress
- Frege
- Friendly interactive shell
- Frink
- Gambas
- GAP
- Gecho
- Gema
- Glee
- Go
- Golfscript
- Gosu
- Groovy
- GW-BASIC
- Haskell
- HicEst
- HLA
- HQ9+
- HQ9+ examples needing attention
- Icon
- Unicon
- IDL
- Inform 6
- Integer BASIC
- Io
- Ioke
- IWBASIC
- J
- Java
- Jacquard Loom
- JavaScript
- JCL
- Joy
- Julia
- Kaya
- Kdf9 Usercode
- Kdf9 examples needing attention
- Kite
- KonsolScript
- Lang5
- Liberty BASIC
- Limbo
- Lisaac
- Logo
- Logtalk
- LOLCODE
- LotusScript
- LSE64
- Lua
- M4
- Maple
- Mathematica
- MATLAB
- Maxima
- MAXScript
- Mercury
- Metafont
- MIPS Assembly
- MIRC Scripting Language
- ML/I
- Modula-2
- Modula-3
- MUF
- MUMPS
- Mythryl
- Neat
- Nemerle
- NetRexx
- NewLISP
- Nimrod
- Node.js
- Oberon-2
- Objeck
- Objective-C
- OCaml
- Occam
- Octave
- Onyx
- OOC
- OoRexx
- Openscad
- Oxygene
- Oz
- PARI/GP
- Pascal
- PASM
- PDP-11 Assembly
- Perl
- Perl 6
- PHP
- PicoLisp
- PIR
- Pike
- PL/I
- Pop11
- PostScript
- PowerShell
- ProDOS
- Prolog
- PSQL
- Pure
- PureBasic
- Python
- Quill
- R
- Racket
- Raven
- REALbasic
- REBOL
- Retro
- REXX
- RTL/2
- Ruby
- Run BASIC
- Rust
- Salmon
- SAS
- Sather
- Scala
- Scheme
- Sed
- Seed7
- Self
- Shiny
- SIMPOL
- Sisal
- Slate
- Smalltalk
- SNOBOL4
- SNUSP
- Standard ML
- Suneido
- Teco
- Tcl
- TestML
- TI-83 BASIC
- TI-89 BASIC
- TorqueScript
- Transact-SQL
- Trith
- TPP
- TUSCRIPT
- UNIX Shell
- C Shell
- Unlambda
- Unlambda examples needing attention
- Ursala
- V
- Vala
- VBScript
- Vedit macro language
- VHDL
- Whenever
- X86 Assembly
- XL
- XPL0
- XSLT
- Yorick
- Z80 Assembly