Hello world/Text

From Rosetta Code
< Hello world(Redirected from Hello world)
Jump to: navigation, search
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


[edit] 0815


[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

Using WTO Macro to generate SVC 35 and message area:

         WTO   'Goodbye, World!'
BR 14 Return

[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.
ldx #0 ; Starting index 0 in X register.
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.
rts ; Return from subroutine.
.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

[edit] 8086 Assembly

TXT DB "Goodbye, World!$"
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

With A86 or NASM syntax:

  org 100h

  mov dx, msg
  mov ah, 9
  int 21h

  mov ax, 4c00h
  int 21h

  db "Goodbye, World!$"

[edit] ABAP

REPORT zgoodbyeworld.
WRITE 'Goodbye, World!'.

[edit] 8th

"Goodbye, World!\n" . bye

[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
Put_Line ("Goodbye, World!");
end Main;

[edit] Aime

o_text("Goodbye, World!\n");


o_text("Goodbye, World!\n");
return 0;

[edit] Algae

printf("Goodbye, World\n");

[edit] ALGOL 60


[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')

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


[edit] Apricot

(puts "Goodbye, World!")

[edit] Arendelle

"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] ARM Assembly

.global main
.asciz "Goodbye, World!\n"
.align 4
ldr r0, =message
bl printf
mov r7, #1
swi 0

[edit] Asymptote

write('Goodbye, World!');

[edit] ATS

implement main0 () = print "Goodbye, World!\n"

[edit] AutoHotkey

script launched from windows explorer

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.

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

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

Note that the i here is the imaginary i, not the lowercase letter i.

Disp "Goodbye, World!",i

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

echo "Goodbye, World!"

[edit] BASIC256

PRINT "Goodbye, World!"

[edit] Battlestar

const hello = "Goodbye, World!\n"

[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!")

[edit] Befunge

52*"!dlroW ,eybdooG">:#,_@

[edit] Blast

# This will display a goodbye message on the terminal screen
display "Goodbye, World!"
# 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
say("Goodbye, World!")

[edit] Brainf***

To print text, we need the ascii-value of each character to output.
So, 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
>>>> + ..
< .
< +++++ +++ .
>>> + .
<< + .
<<<< ++++ .
< ++ .
>>> +++++ ++ .
>>> .
+++ .
< +++++ ++ .
----- --- .
<<<<< + .
< +++ . --- .



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


#include <stdlib.h>
#include <stdio.h>
int main(void)
puts("Goodbye, World!");

Or, the eternal favourite :)

int main()
printf("\nGoodbye, World!");
return 0;

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

<<< "Goodbye, World!">>>;

[edit] C++

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

[edit] C++/CLI

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

[edit] C1R

$ 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.
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
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!"
Works with: Rhino engine
print "Goodbye, World!"

[edit] ColdFusion

<cfoutput>Goodbye, World!</cfoutput>

[edit] Common Lisp

(format t "Goodbye, World!~%")

[edit] Component Pascal

Out.String("Goodbye, World!"); Out.Ln
END Hello.

Run command Hello.Do by commander.

[edit] Crack

import crack.io cout;
cout `Goodbye, World!\n`;

[edit] Creative Basic

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.

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

[edit] dc

[Goodbye, World!]p

[edit] DCL

$ write sys$output "Goodbye, World!"

[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

[edit] Déjà Vu

!print "Goodbye, World!"

[edit] Delphi

program ProjectGoodbye;
WriteLn('Goodbye, World!');

[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: Mono version 3.x.y
Works with: .NET version 3.5
Works with: .NET version 4.0
Works with: .NET version 4.5

One Line version:

Console::WriteLine("Goodbye, World!")

Hello World Program:

//compile using the new dylan.NET v, or later
//use mono to run the compiler
#refstdasm mscorlib.dll
import System
assembly helloworld exe
class public Program
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] EchoLisp

(display "Goodbye, World" "color:blue")

[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)

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)
print ("Goodbye, World!%N")

[edit] Ela

open monad io
do putStrLn "Googbye, World!" ::: IO

[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

[edit] Elena

#symbol Program =
system'console writeLine:"Goodbye, World!".

[edit] Elena Script

#define start ::= "?" < system'console.eval&writeLine( > $literal < ) >;
? "Goodbye, 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] ERRE

! Hello World in ERRE language
PRINT("Goodbye, World!")

[edit] EGL

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

[edit] Euler Math Toolbox

"Goodbye, World!"

[edit] Extended BrainF***

[.>]@Goodbye, World!

[edit] Ezhil

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

[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


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!

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

'FreeBASIC Hello-fb0.bas May 2015
Screen 0 'open text window
Print "Hello world"
Print "Enter any key to go the graphics screen"
screen 18 'Screen 18 Resolution 640x480 with at least 256 colors
locate 10,10
Print "Hello world!"
locate 20,10
Print "Enter any key to exit"

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

show_message("Goodbye, World!"); // displays a pop-up message
show_debug_message("Goodbye, World!"); // sends text to the debug log or IDE

[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");

[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


[edit] Glee

"Goodbye, World!"


'Goodbye, World!'

or to display with double quotes


or to display with single quotes


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

trace("Goodbye, World!");

[edit] HicEst

WRITE() 'Goodbye, World!'

[edit] HLA

program goodbyeWorld;
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.
  • 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!" )

[edit] IDL

print,'Goodbye, World!'

[edit] Inform 6

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.

20 END

[edit] Io

"Goodbye, World!" println

[edit] Ioke

"Goodbye, World!" println

[edit] IWBASIC

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.

[edit] J

   'Goodbye, World!'
Goodbye, World!

Here are some redundant alternatives:

   [data=. 'Goodbye, World!'
Goodbye, World!
Goodbye, World!
smoutput data
Goodbye, World!

[edit] Jack

class Main {
function void main () {
do Output.printString("Goodbye, World!");
do Output.println();

[edit] Jacquard Loom

This weaves the string "Goodbye, World!"

| |
| * * |
|* * * * |
|* * *|
|* * *|
|* * * |
| * * * |
| * |
| |
|* * * |
|* * * |
| * *|
| * *|
|* * * |
|* * * * |
| * |
| |
|* ** * * |
|******* *** * |
| **** * * ***|
| **** * ******|
| ****** ** * |
| * * * * |
| * |
| |
|******* *** * |
|******* *** * |
| ** *|
|* * * *|
|******* ** * |
|******* *** * |
| * |
| |
|******* *** * |
|******* *** * |
| * * * *|
| * * * *|
|******* ** * |
|******* ** * |
| * |
| |
|***** * *** * |
|******* *** * |
| * * * * |
| * * * |
|****** ** * |
|****** ** * |
| * |
| |
| * * * |
|***** * ***** |
|***** ** * ***|
|***** ** * ***|
|******* * ** |
| * * * * |
| * |
| |
| |
| * * |
| * * |
| * |
| * |
| |
| |

[edit] Java

public class HelloWorld
public static void main(String[] args)
System.out.println("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;

[edit] Kite

simply a single line

"Goodbye, World!"|print;

[edit] Kitten

"Goodbye, World!" say

[edit] KonsolScript

Displays it in a text file or console/terminal.

function main() {
Konsol:Log("Goodbye, World!")

[edit] Kotlin

fun main(args: Array<String>) {
println("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("Goodbye, 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] LiveCode

Example on OS X using livecode-server in shell script

#! /usr/local/bin/livecode-server
set the outputLineEndings to "lf"
put "Goodbye, World!" & return
Livecode also supports stdout as a device to write to
write "Goodbye, World!" & return to stdout

[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


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

VISIBLE "Goodbye, World!"

[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

[edit] M4

For the particular nature of m4, this is simply:

`Goodbye, World!'

[edit] make

Makefile contents:

$(info Goodbye, World!)

Running make produces:

Goodbye, World!
make: Nothing to be done for `all'.

[edit] Malbolge

Long Version:


Short Version:


[edit] Maple

> printf( "Goodbye, World!\n" ): # print without quotes
Goodbye, World!

[edit] Mathematica

Print["Goodbye, World!"]

[edit] MATLAB

>> disp('Goodbye, World!')

[edit] Maude

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

[edit] Maxima

print("Goodbye, World!");

[edit] MAXScript

print "Goodbye, World!"


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
Works with: SPIM
hello: .asciiz "Goodbye, World!"
la $a0, hello
li $v0, 4
li $v0, 10

[edit] mIRC Scripting Language

echo -ag Goodbye, World!

[edit] ML/I

Goodbye, World!

[edit] Modula-2

InOut.WriteString('Goodbye, World!');
END Hello.

[edit] Modula-3

IO.Put("Goodbye, World!\n");
END Goodbye.

[edit] MUF

: main[ -- ]
me @ "Goodbye, World!" notify

[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("Goodbye, World!");

[edit] NetRexx

say  'Goodbye, World!'

[edit] newLISP

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

[edit] Nim

echo("Goodbye, World!")

[edit] Nit

print "Goodbye, World!"

[edit] Oberon-2

MODULE Goodbye;
Out.String("Goodbye, World!");Out.Ln
END World;
END Goodbye.

[edit] Objeck

class Hello {
function : Main(args : String[]) ~ Nil {
"Goodbye, World!"->PrintLine();

[edit] Objective-C

Works with: clang-602.0.53

The de facto Objective-C "Hello, World!" program is most commonly illustrated as the following, using the NSLog() function:

#import <Foundation/Foundation.h>
int main() {
@autoreleasepool {
NSLog(@"Hello, World!");

However the purpose of the NSLog() function is to print a message to standard error prefixed with a timestamp, which does not meet the most common criteria of a "Hello, World!" program of displaying only the requested message to standard output.

The following code prints the message to standard output without a timestamp using exclusively Objective-C messages:

#import <Foundation/Foundation.h>
int main() {
@autoreleasepool {
NSFileHandle *standardOutput = [NSFileHandle fileHandleWithStandardOutput];
NSString *message = @"Hello, World!\n";
[standardOutput writeData:[message dataUsingEncoding:NSUTF8StringEncoding]];

Objective-C also supports functions contained within the C standard library. However, Objective-C's NSString objects must be converted into a UTF-8 string in order to be supported by the C language's I/O functions.

#import <Foundation/Foundation.h>
int main() {
@autoreleasepool {
NSString *message = @"Hello, World!\n";
printf("%s", message.UTF8String);

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

"Goodbye, World!" println

[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;
HelloClass = class
class method Main;
class method HelloClass.Main;
System.Console.WriteLine('Goodbye, World!');
Goodbye, World!

[edit] Oz

{Show "Goodbye, World!"}

[edit] PARI/GP

print("Goodbye, World!")

[edit] Pascal

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

[edit] PASM

print "Goodbye, World!\n"

[edit] PDP-11 Assembly

Works with: UNIX version 7

This is tested on Unix v7 Prints "Goodbye, World!" to stdout:

.globl  start
mov $1,r0
sys 4; outtext; outlen
sys 1
rts pc
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!';


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

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"

[edit] Pike

int main(){
write("Goodbye, World!\n");

[edit] PL/I

goodbye:proc options(main);
put list('Goodbye, World!');
end goodbye;

[edit] Pony

actor Main
new create(env: Env) =>
env.out.print("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

   S = 'Goodbye, World!';

[edit] Pure

using system;
puts "Goodbye, World!\n" ;

[edit] PureBasic

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

class HelloWorld
**Prints "Goodbye, World!"**
on start
print "Goodbye, World!"

[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!"
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;
TWRT("Goodbye, World!#NL#");

[edit] Ruby

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


$stdout.puts "Goodbye, World!"

or even

 STDOUT.write "Goodbye, World!\n"

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


print("Goodbye, World!\n");


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

[edit] Sather

main is
#OUT+"Goodbye, World!\n";

[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.err.println ("Err deviated")
Console.setErr(Console.err) // Reset to normal

[edit] Scheme

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

or just:

"Goodbye, World!"

(should work on any scheme)

[edit] R7RS Scheme

(import (scheme base)
(scheme write))
(display "Goodbye, World!")

[edit] Scilab

disp("Goodbye, World!");

[edit] sed

Goodbye, World!

[edit] Seed7

$ include "seed7_05.s7i";
const proc: main is func
writeln("Goodbye, World!");
end func;

[edit] Self

'Goodbye, World!' printLine.

[edit] Shen

(output "Goodbye, World!~%")

[edit] Shiny

say 'Goodbye, World!'

[edit] Sidef

„Goodbye, World!”.say;

[edit] SIMPOL

function main()
end function "Goodbye, World!{d}{a}"

[edit] Simula

Works with: SIMULA-67
OUTTEXT("Goodbye, World!");

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

PRINT "Goodbye, World!"

[edit] SNOBOL4

Using CSnobol4 dialect

    OUTPUT = "Goodbye, World!"

[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
call print

[edit] Sparkling

print("Goodbye, World!");

[edit] SPARC Assembly

.section ".text"
.global _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
.ascii "Goodbye, world!\n"

[edit] Standard ML

print "Goodbye, World!\n"

[edit] Suneido

Print("Goodbye, World!")

[edit] Swift

Works with: Swift version 2.x+
print("Goodbye, World!")
Works with: Swift version 1.x
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

Disp "Goodbye, World!

(Lowercase letters DO exist in TI-BASIC, though you need an assembly program to enable them.)

[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!


PRINT "Goodbye, World!"


Goodbye, World!

[edit] Uniface

message "Goodbye, World!"

[edit] UNIX Shell

Works with: Bourne Shell
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] Uniface

message "Goodbye, World!"

[edit] Ursala

output as a side effect of compilation

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

USE std.TEXTIO.all;
entity test is
end entity test;
architecture beh of test is
variable line_out : line;
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] Whitespace

There is a "Hello World" - example-program on the Whitespace-website

[edit] Wolfram Language

Print["Goodbye, World!"]

[edit] Wren

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

WriteLn "Goodbye, World!"

[edit] XPL0

code Text=12;
Text(0, "Goodbye, World!

[edit] XSLT

<xsl:text>Goodbye, World!

[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
world: defm "Goodbye, World!\r\n\0"

[edit] zkl

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