Hello world/Text

From Rosetta Code
< Hello world(Redirected from Hello world)
Jump to: navigation, search
Task
Hello world/Text
You are encouraged to solve this task according to the task description, using any language you may know.
Hello world/Text is part of Short Circuit's Console Program Basics selection.
In this User Output task, the goal is to display the string "Goodbye, World!" [sic] on a text console.

See also

Contents

[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

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] 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 main0 () = 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

Works with: BASICA
Works with: Locomotive Basic
Works with: ZX Spectrum Basic
10 PRINT "Goodbye, World!"
Works with: 7Basic
Works with: QBasic
PRINT "Goodbye, World!"

[edit] BASIC256

PRINT "Goodbye, World!"

[edit] Battlestar

const hello = "Goodbye, World!\n"
write(hello)

[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] BML

display "Goodbye, World!"

[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

Works with: gcc version 4.0.1
#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#

Works with: Mono version 1.2
Works with: Visual C# version 2003
 
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Goodbye, World!");
}
}
}
 

[edit] C++

#include <iostream>
 
int main () {
std::cout << "Goodbye, World!\n";
}

[edit] C++/CLI

using namespace System;
int main()
{
Console::WriteLine("Goodbye, World!");
}

[edit] C1R

Hello_world/Text
Output:
$ echo Hello_world/Text >hw.c1r
$ ./c1r hw.c1r
$ ./a.out
Goodbye, World!

[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] Clipper

? "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.

Works with: OpenCOBOL
	program-id. hello.
procedure division.
display "Goodbye, World!".
stop run.

[edit] Cobra

class Hello
def main
print 'Goodbye, World!'

[edit] CoffeeScript

Works with: Node.js
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] Crystal

puts "Goodbye, World!"

[edit] D

Works with: D version 2.0
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] DDNC

DDNC can only output to a single 7-segment LED display digit, so first we must convert each character into its 7-segment equivalent numerical value.

The three horizontal bars are assigned bits 6, 3, and 0 from top to bottom. The top two vertical bars are assigned bits 5 and 4 while the bottom two vertical bars are assigned bits 2 and 1 from left to right.

Because DDNC can only interpret literals in decimal, each binary number was converted and stored in consecutive memory cells starting at cell 10.

The code can be divided into three sections. The first stores the character numbers in order in an array. The second sets up the loop by loading a delay of 500 milliseconds to slot 3, the start address of the character array in memory to slot 2, and the number of times to loop (14) plus one to slot 5. The third section starts the loop of displaying the characters, waiting for the delay time, incrementing the pointer, decrementing the counter, and checking if the counter is negative to know whether to continue the loop.

 
0 111 10
0 15 11
0 15 12
0 31 13
0 47 14
0 59 15
0 125 16
0 3 17
0 0 18
0 63 19
0 15 20
0 12 21
0 36 22
0 31 23
0 17 24
 
0 500 3
0 10 2
0 15 5
 
60 4
2 2 1
80 1
72 3
30 2
31 5
62 5
61 4
64
 

[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

Works with: Mono version 2.6.7
Works with: Mono version 2.10.x
Works with: .NET version 3.5
Works with: .NET version 4.0

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] ECL

 
OUTPUT('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] Egison

 
(define $main
(lambda [$argv]
(write-string "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 =
[
system'console writeLine:"Goodbye, World!".
].

[edit] Elena Script

[[
#define start ::= "?" < system'console.eval&writeLine( > $literal < ) >;
]]
 
? "Hello World!!"
 

[edit] Elisa

 "Goodbye, World!"? 

[edit] Elixir

 
IO.puts "Goodbye, World!"
 

[edit] Elm

main = plainText "Goodbye World!"

[edit] Emacs Lisp

(insert "Goodbye, World!")

[edit] Erlang

io:format("Goodbye, World!~n").

[edit] Euphoria

puts(1,"Goodbye, World!\n")

[edit] EGL

Works with: EDT
Works with: RBD
 
program HelloWorld
function main()
SysLib.writeStdout("Goodbye, World!");
end
end
 

[edit] Euler Math Toolbox

"Goodbye, World!"

[edit] Ezhil

பதிப்பி"வணக்கம் உலகம்!"
பதிப்பி "Goodbye, World!"
பதிப்பி"******* வணக்கம்! மீண்டும் சந்திப்போம் *******"
exit()

[edit] F#

printfn "%s" "Goodbye, World!"

or using .Net classes directly

System.Console.WriteLine("Goodbye, World!")

[edit] Factor

"Goodbye, World!" print

[edit] Falcon

With the printl() function:

printl("Goodbye, World!")

Or via "fast print":

> "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

say "Goodbye, World!"

[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

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] Fortress

export Executable                                                                                                                       
 
run() = println("Goodbye, World!")

[edit] Frege

Works with: Frege version 3.20.113
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] FunL

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] Gentee

func hello <main>
{
print("Goodbye, World!")
}

[edit] GLBasic

STDOUT "GOODBYE, WORLD!"

[edit] Glee

"Goodbye, World!"

[edit] Go

package main
 
import "fmt"
 
func main() { fmt.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] Hack

<?hh echo 'Goodbye, World!'; ?>

[edit] Harbour

? "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+

This example is incorrect. output isn't consistent with the task's requirements (and is probably incapable of solving the task). Please fix the code and remove this message.
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!");
Works with: NJS version 0.2.5
Works with: Rhino
Works with: SpiderMonkey
print('Goodbye, World!');
Works with: JScript
WScript.Echo("Goodbye, World!");
Works with: Node.js
console.log("Goodbye, World!")

[edit] JCL

/*MESSAGE Goodbye, World!

[edit] Joy

"Goodbye, World!" putchars.

[edit] jq

"Goodbye, World!"

[edit] Julia

println("Goodbye, World!")

[edit] Kaya

program hello;
 
Void main() {
// My first program!
putStrLn("Goodbye, World!");
}

[edit] Kdf9 Usercode

This example is incorrect. output isn't consistent with the task's requirements: wording, punctuation. Please fix the code and remove this message.
 
 
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] Lasso

A plain string is output automatically.

'Goodbye, World!'

[edit] Lang5

"Goodbye, World!\n" .

[edit] LFE

 
(: io format '"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

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] LLVM

@str = internal constant [14 x i8] c"Hello, world!\00"
declare i32 @puts(i8*)
define i32 @main()
{
call i32 @puts( i8* getelementptr ([14 x i8]* @str, i32 0,i32 0))
ret i32 0
}

[edit]

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(write('Goodbye, World!\n')).
 
:- 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!"

Harder way with a table:

 
local chars = {"G","o","o","d","b","y","e",","," ","W","o","r","l","d","!"}
for i = 1, #chars do
write(chars[i])
end
 

[edit] M4

For the particular nature of m4, this is simply:

`Goodbye, World!'

[edit] Malbolge

Long Version:

('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>

Short Version:

(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc

Output: HELLO 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] Maude

 
fmod BYE-WORLD is
 
protecting STRING .
 
op sayBye : -> String .
 
eq sayBye = "Goodbye, World!" .
 
endfm
 
red sayBye .
 

[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

Works with: MARS
and
Works with: SPIM
   .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] MySQL

SELECT '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] Neko

$print("Hello, World!");

[edit] NetRexx

say  'Goodbye, World!'

[edit] newLISP

Works with: newLisp version 6.1 and after
(println "Goodbye, World!")

[edit] Nimrod

echo("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

Works with: GCC

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

Works with: kroc
#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

To print a String, either call its println() method:

main: func {
"Goodbye, World!" println()
}

Or call the free println() function with the String as the argument.

main: func {
println("Goodbye, World!")
}

[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

Works with: Free Pascal
program byeworld;
begin
writeln('Goodbye, World!');
end.

[edit] PASM

print "Goodbye, World!\n"
end

[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] 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!';

or:

use 5.010;
say 'Goodbye, World!';

[edit] Perl 6

say 'Goodbye, World!';

[edit] PHL

module helloworld;
extern printf;
 
@Integer main [
printf("Goodbye, World!");
return 0;
]

[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

'Goodbye, World!'
 
#It's considered good practice to use Write-Host, although it works just fine without too
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

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 changed from a statement to a function.

Works with: Python version 3.0
(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

Works with: REALbasic version 5.5

This requires a console application.

Function Run(args() as String) As Integer
Print "Goodbye, World!"
Quit
End Function

[edit] REBOL

print "Goodbye, World!"

[edit] RED

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

Works with: Ruby version 1.8.4
puts "Goodbye, World!"

or

$stdout.puts "Goodbye, World!"

[edit] Run BASIC

print "Goodbye, World!"

[edit] Rust

Works with: rustc version 0.12.0-pre
 
fn main () {
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

Library: Console

[edit] Ad hoc REPL solution

Ad hoc solution as REPL script. Type this in a REPL session:

println("Goodbye, World!")

[edit] Via Java runtime

This is a call to the Java run-time library. Not recommendated.

System.out.println("Goodbye, World!")

[edit] Via Scala Console API

This is a call to the Scala run-time library. Recommendated.

println("Goodbye, World!")

[edit] Short term deviation to out

Console.withErr(Console.out) { Console.err.println("This goes to default _out_") }

[edit] Long term deviation to out

  Console.err.println ("Err not deviated")
Console.setErr(Console.out)
Console.err.println ("Err deviated")
Console.setErr(Console.err) // Reset to normal

[edit] Scheme

Works with: Gauche
Works with: Guile
(display "Goodbye, World!")
(newline)
Works with: Gauche
(print "Goodbye, World!")

or just:

"Goodbye, World!"

(should work on any scheme)

[edit] R7RS Scheme

(import (scheme base)
(scheme write))
(display "Hello, world!")
(newline)

[edit] Scilab

disp("Goodbye, World!");

[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] Sidef

„Goodbye, World!”.say;

[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.
Works with: GNU Smalltalk
(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] SoneKing Assembly

 
extern print
 
dv Msg Goodbye,World!
 
mov eax Msg
push
call print
pop
 

[edit] Sparkling

print("Goodbye, World!");

[edit] SPARC Assembly

 
.section ".text"
.global _start
_start:
mov 4,%g1 ! 4 is SYS_write
mov 1,%o0 ! 1 is stdout
set .msg,%o1 ! pointer to buffer
mov (.msgend-.msg),%o2 ! length
ta 8
 
mov 1,%g1 ! 1 is SYS_exit
clr %o0 ! return status is 0
ta 8
 
.msg:
.ascii "Goodbye, world!\n"
.msgend:
 

[edit] Standard ML

print "Goodbye, World!\n"

[edit] Suneido

Print("Goodbye, World!")

[edit] Swift

println("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

Works with: Bourne 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.d.!i

[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] உயிர்/Uyir

முதன்மை என்பதின் வகை பணி {{
{"உலகத்தோருக்கு வணக்கம்"} என்பதை திரையீடு;
}};

[edit] V

"Goodbye, World!" puts

[edit] Vala

void main(){
stdout.printf("Goodbye, World!\n");
}

[edit] VBScript

Works with: Windows Script Host version 5.7
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] Vim Script

echo "Goodbye, World!\n"

[edit] Wart

prn "Goodbye, World!"

[edit] Whenever

1 print("Goodbye, World!");

[edit] Whiley

import whiley.lang.System
 
method main(System.Console console):
console.out.println("Goodbye, World!")

[edit] Wolfram Language

Print["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] 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"

[edit] zkl

println("Goodbye, World!");
Personal tools
Namespaces

Variants
Actions
Community
Explore
Misc
Toolbox