Hello world/Text

Revision as of 13:59, 5 October 2011 by 71.84.160.59 (talk) (Added an Inform 6 entry)

In this User Output task, the goal is to display the string "Goodbye, World!" [sic] on a text console.

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.

See also


4DOS Batch

<lang 4dos>echo Goodbye, World!</lang>

6502 Assembly

<lang asm>; helloworld.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 "Hello, world!", a_cr, 0</lang>

8086 Assembly

<lang masm>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</lang>

ABAP

<lang ABAP>REPORT zgoodbyeworld.

 WRITE 'Goodbye, World!'.</lang>

ActionScript

<lang ActionScript>trace("Goodbye, World!");</lang>

Ada

Works with: GCC version 4.1.2

<lang ada>with Ada.Text_IO; use Ada.Text_IO; procedure Main is begin

 Put_Line ("Goodbye, World!");

end Main;</lang>

Aikido

<lang aikido>println ("Goodbye, World!")</lang>

Aime

<lang aime>o_text("GOODBYE, WORLD!\n");</lang>

or:

<lang aime> integer main(void) {

   o_text("GOODBYE, WORLD!\n");
   return 0;

} </lang>

Algae

<lang algae>printf("Goodbye, World\n");</lang>

ALGOL 68

<lang algol68>main: (

 printf($"Goodbye, World!"l$)

)</lang>

AmbientTalk

<lang ambienttalk>system.println("Goodbye, World!")</lang>

AmigaE

<lang amigae>PROC main()

 WriteF('Goodbye, World!\n')

ENDPROC</lang>

AppleScript

To show in Script Editor Result pane: <lang applescript>"Goodbye, World!"</lang>

To show in Script Editor Event Log pane: <lang applescript>log "Goodbye, World!"</lang>

Applesoft BASIC

<lang Applesoft BASIC> PRINT "GOODBYE, WORLD!"</lang>

Argile

<lang Argile>use std print "Goodbye, World!"</lang> compile with: arc hello_world.arg -o hello_world.c && gcc -o hello_world hello_world.c

Asymptote

<lang asymptote>write('Goodbye, world!');</lang>

AutoHotkey

script launched from windows explorer <lang AutoHotkey>DllCall("AllocConsole") FileAppend, Goodbye`, World!, CONOUT$ FileReadLine, _, CONIN$, 1</lang> scripts run from shell [requires Windows XP or higher; older Versions of Windows don´t have the "AttachConsole" function] <lang AutoHotkey>DllCall("AttachConsole", "int", -1) FileAppend, Goodbye`, World!, CONOUT$</lang> <lang AutoHotkey>SendInput Goodbye, World{!}</lang>

AWK

<lang awk>BEGIN{print "Goodbye, World!"}</lang>

Here there is no significant difference between BEGIN and END, as the input is empty. So this version is shorter:

<lang awk>END{print"Hello, world!"}</lang>

BASIC

Works with: BASICA
Works with: Locomotive Basic
Works with: ZX Spectrum Basic

<lang qbasic>10 print "Goodbye World!"</lang>

Works with: 7Basic
Works with: QBasic

<lang qbasic>PRINT "Goodbye, World!"</lang>

Batch File

<lang dos>echo Goodbye, World!</lang>

BBC BASIC

<lang bbcbasic> PRINT "Goodbye, World!"</lang>

bc

<lang bc>"Goodbye, World! "</lang>

BCPL

<lang BCPL>GET "libhdr"

LET start() = VALOF { writef("Goodbye, World!")

 RESULTIS 0

}</lang>

Befunge

<lang befunge>0"!dlrow ,eybdooG">:#,_@</lang>

Blast

<lang blast># This will display a goodbye message on the terminal screen .begin display "Goodbye, world!" return

  1. This is the end of the script.</lang>

Boo

<lang boo>print "Goodbye, World!"</lang>

Brace

<lang brace>#!/usr/bin/env bx use b Main: say("Goodbye, World!")</lang>

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: <lang bf>+++++ +++++ 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 < +++ . --- .</lang>

Uncommented: <lang bf>++++++++++[>+>+++>++++>+++++++>++++++++>+++++++++>++ ++++++++>+++++++++++>++++++++++++<<<<<<<<<-]>>>>+.>>> >+..<.<++++++++.>>>+.<<+.<<<<++++.<++.>>>+++++++.>>>.+++. <+++++++.--------.<<<<<+.<+++.---.</lang> It can most likely be optimized, but this is a nice way to show how character printing works in Brainf*** :)

Bracmat

<lang bracmat>put$"Goodbye, world!"</lang>

Brat

<lang brat>p "Goodbye, world!"</lang>

Brlcad

The mged utility can output text to the terminal:

<lang brlcad> echo Hello World! </lang>

C

Works with: gcc version 4.0.1

<lang c>#include <stdlib.h>

  1. include <stdio.h>

int main(void) {

 printf("Goodbye, World!\n");
 return EXIT_SUCCESS;

}</lang> Or: <lang c>#include <stdlib.h>

  1. include <stdio.h>

int main(void) {

 puts("Goodbye, World!");
 return EXIT_SUCCESS;

}</lang>

C#

Works with: Mono version 1.2
Works with: Visual C# version 2003

<lang csharp>System.Console.WriteLine("Goodbye, World!");</lang>

C++

<lang cpp>#include <iostream>

int main () {

 std::cout << "Goodbye, World!" << std::endl;
 return std::cout.bad();

}</lang>

C++/CLI

<lang cpp>using namespace System; int main() {

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

}</lang>

C0H

The smallest Hello World source code thinkable!

<lang C0H></lang>

Chef

<lang Chef>Hello World Souffle.

This recipe prints the immortal words "Hello world!", in a basically brute force way. It also makes a lot of food for one person.

Ingredients. 72 g haricot beans 101 eggs 108 g lard 111 cups oil 32 zucchinis 119 ml water 114 g red salmon 100 g dijon mustard 33 potatoes

Method. Put potatoes into the mixing bowl. Put dijon mustard into the mixing bowl. Put lard into the mixing bowl. Put red salmon into the mixing bowl. Put oil into the mixing bowl. Put water into the mixing bowl. Put zucchinis into the mixing bowl. Put oil into the mixing bowl. Put lard into the mixing bowl. Put lard into the mixing bowl. Put eggs into the mixing bowl. Put haricot beans into the mixing bowl. Liquefy contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish.

Serves 1.</lang>

Clay

<lang clay>main() {

   println("Goodbye, world!");

}</lang>

Clean

<lang clean>Start = "Goodbye, World!"</lang>

CLIPS

<lang clips>(printout t "Goodbye, World!" crlf)</lang>

Clojure

<lang lisp>(prn "Goodbye, world!")</lang>

CMake

<lang cmake>message(STATUS "Goodbye, world!")</lang>

This outputs

-- Goodbye, world!

COBOL

Using fixed format.

<lang cobol> program-id. hello. procedure division. display "Goodbye, world!". stop run.</lang>

Cobra

<lang cobra>class Hello

   def main
       print 'Goodbye, World'</lang>

CoffeeScript

Works with: Node.js

<lang coffeescript>console.log "Goodbye, World!"</lang>

Common Lisp

<lang lisp>(format t "Goodbye, world!~%")</lang>

Component Pascal

<lang oberon2> MODULE Hello; IMPORT Out;

PROCEDURE Do*; BEGIN Out.String("Hello, world!"); Out.Ln END Do; END Hello.</lang> Run command Hello.Do by commander.

Crack

<lang crack> import crack.io cout; cout `hello world!\n`; </lang>

D

Works with: D version 2.0

<lang D>import std.stdio;

void main() {

   writeln("Goodbye, World!");

}</lang>

Dao

<lang dao>io.writeln( 'Goodbye, World!' )</lang>

dc

<lang dc>[Goodbye, World!]p</lang>

Delphi

<lang delphi> program ProjectGoodbye; {$APPTYPE CONSOLE} begin

 WriteLn('Goodbye, World!');

end. </lang>

DWScript

<lang delphi> PrintLn('Goodbye, World!'); </lang>

Dylan

<lang Dylan> module: hello-world

format-out("%s\n", "Goodbye, World!"); </lang>

Dylan.NET

One Line version: <lang Dylan.NET>Console::WriteLine("Hello World!")</lang> Hello World Program: <lang Dylan.NET> //compile using the new dylan.NET(not finished yet) //leave a copy of mscorlib.dll in the same directory as this file

  1. refasm mscorlib.dll

import System

assembly helloworld exe ver 1.1.0.0

class public auto ansi Module1

  method public static void main()
     Console::WriteLine("Hello World!")
  end method

end class </lang>

E

<lang e>println("Goodbye, World!")

stdout.println("Goodbye, World!")</lang>

eC

<lang ec>class GoodByeApp : Application {

  void Main()
  {
     PrintLn("Goodbye, World!");
  }

}</lang>

Efene

short version (without a function)

<lang efene>io.format("Goodbye, world~n")</lang>

complete version (put this in a file and compile it)

<lang efene>@public run = fn () {

   io.format("Goodbye, world~n")

}</lang>

Ela

<lang ela>open Con writen "Goodbye world" </lang>

elastiC

From the elastiC Manual.

<lang elastic>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();</lang>


Elena

<lang elena>#symbol Program => [

   'program'output << "Goodbye, World!%n".

].</lang>

Elisa

<lang elisa> "Goodbye,World!"? </lang>

Erlang

<lang erlang>io:format("Goodbye, world~n").</lang>

Euphoria

<lang Euphoria>puts(1,"Goodbye, world!\n")</lang>

F#

<lang fsharp>printfn "%s" "Goodbye, world"</lang> or using .Net classes directly <lang fsharp>System.Console.WriteLine("Goodbye, World!")</lang>

Factor

<lang factor>"Goodbye, world." print</lang>

Falcon

<lang false>> "Goodbye, World!"</lang>

FALSE

<lang false>"Goodbye, World! "</lang>

Fantom

<lang fantom> class HelloText {

 public static Void main ()
 {
   echo ("Goodbye, World!")
 }

} </lang>

ferite

<lang ferite>uses "console"; Console.println( "Goodby, World" );</lang>

Fish

Standard Hello, world example, modified for this task: <lang Fish>!v"Goodbye, world"r!

>l?!;o</lang>

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.

Forth

<lang forth>." Goodbye, World!"</lang>

Or as a whole program:

<lang forth>: goodbye ( -- ) ." Goodbye, World!" CR ;</lang>

Fortran

Works with: F77

Simplest case - display using default formatting:

<lang fortran>print *,"Goodbye, world"</lang>

Use explicit output format:

<lang fortran>100 format (5X,A,"!")

     print 100,"Goodbye, world"</lang>

Output to channels other than stdout goes like this:

<lang fortran>write (89,100) "Goodbye, world"</lang>

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

Fortress

<lang fortress>export Executable

run() = println("Goodbye, world!")</lang>

Frink

<lang frink> println["Hello, World!"] </lang>

Gambas

<lang gambas> PRINT "Goodbye, World!" </lang>

GAP

<lang gap># Several ways to do it "Hello, World!";

Print("Hello, World!\n"); # No EOL appended

Display("Hello, World!");

f := OutputTextUser(); WriteLine(f, "Hello, World!\n"); CloseStream(f);</lang>

gecho

<lang gecho>'Hello, <> 'world! print</lang>

Gema

Gema ia a preprocessor that reads an input file and writes an output file. This code will write "Goodby, World!' no natter what input is given.

<lang gema>*= ! ignore off content of input \B=Goodby, World\! ! Start output with this text.</lang>

Glee

<lang glee>"Goodbye, World!"</lang>

Go

<lang go>package main

import "fmt"

func main() { fmt.Println("Goodbye, World!") }</lang>

Golfscript

<lang golfscript>"Goodbye, World!"</lang>

Gosu

<lang gosu>print("Goodbye, World")</lang>

Groovy

<lang groovy>println "Goodbye, World"</lang>

GW-BASIC

<lang qbasic>10 PRINT "Goodbye World!"</lang>

Haskell

<lang haskell>main = putStrLn "Goodbye, world"</lang>

HicEst

<lang hicest>WRITE() 'Goodbye, World!'</lang>

HLA

<lang HLA>program goodbyeWorld;

  1. include("stdlib.hhf")

begin goodbyeWorld;

 stdout.put( "Goodbye, World!" nl );

end goodbyeWorld;</lang>

HQ9+

<lang hq9plus>H</lang>

Icon and Unicon

<lang icon>procedure main()

 write( "Goodbye World" )

end</lang>

IDL

<lang idl>print,'Goodbye World'</lang>

Inform 6

<lang Inform 6>[Main;

 print "Goodbye, World!^";

];</lang>

Integer BASIC

<lang Integer BASIC> 10 PRINT "GOODBYE, WORLD!"

  20 END</lang>

Io

<lang Io>"Goodbye, world!" println</lang>

Ioke

<lang ioke>"Goodbye, World!" println</lang>

J

<lang j> 'Goodbye, World!' Goodbye, World!</lang>

Here are some redundant alternatives: <lang J> [data=. 'Goodbye, World!' Goodbye, World!

  data

Goodbye, World!

  smoutput data

Goodbye, World!</lang>

Java

<lang java>public class HelloWorld {

public static void main(String[] args)
{
 System.out.println("Goodbye, World!");
}

}</lang>

JavaScript

<lang javascript>document.write("Goodbye, World!");</lang>

Works with: NJS version 0.2.5
Works with: Rhino
Works with: SpiderMonkey

<lang javascript>print('Hello, World!');</lang>

Works with: JScript

<lang javascript>WScript.Echo("Hello, World!");</lang>

Works with: Node.js

<lang javascript>console.log("Goodbye, World!")</lang>

Joy

<lang joy>"Goodbye, World!" putchars.</lang>

Kdf9 Usercode

<lang joy>

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;

</lang>

Kite

simply a single line <lang Kite>"#!/usr/local/bin/kite

"Hello World"|print;</lang>

KonsolScript

Displays it in a text file or console/terminal. <lang KonsolScript>function main() {

 Konsol:Log("Hello World")

}</lang>

Liberty BASIC

<lang lb>print "Goodbye, World!"</lang>

Limbo

<lang 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");
}</lang>

Lisaac

Works with: Lisaac version 0.13.1

You can print to standard output in Lisaac by calling STRING.print or INTEGER.print:

<lang lisaac>Section Header // The Header section is required.

 + name := GOODBYE;    // Define the name of this object.

Section Public

 - main <- ("Goodbye, World!\n".print;);</lang>

However, it may be more straightforward to use IO.print_string instead:

<lang lisaac>Section Header // The Header section is required.

 + name := GOODBYE2;   // Define the name of this object.

Section Public

 - main <- (IO.put_string "Goodbye, World!\n";);</lang>

Print includes a line feed: <lang logo>print [Goodbye, world!]</lang> Type does not: <lang logo>type [Goodbye, world!]</lang>

Logtalk

<lang 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.</lang>

LotusScript

<lang 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.</lang>

LSE64

<lang lse64>" Goodbye, World!" ,t nl</lang>

Lua

Works with: Lua version 5.1.1

<lang lua>print("Goodbye, World!")</lang>

or:

<lang lua>print "Goodbye, World!"</lang>

In Lua, parentheses are optional for function calls when there is only one argument and this argument is either a string or a table constructor.

M4

For the particular nature of m4, this is simply: <lang m4>`Goodbye, World'</lang>

Mathematica

<lang mathematica>Print["Goodbye, World!"]</lang>

MATLAB

<lang MATLAB>>> 'Goodbye, World!'

ans =

Goodbye, World!</lang>

MAXScript

<lang maxscript>print "Goodbye, World!"</lang> or: <lang maxscript>format "%" "Goodbye, World!"</lang>

Mercury

<lang mecury>:- module hello.

- interface.
- import_module io.
- pred main(io::di, io::uo) is det.
- implementation.

main(!IO) :-

   io.write_string("Goodbye, World!\n", !IO).</lang>

Metafont

<lang metafont>message "Goodbye, World"; end</lang>

MIPS Assembly

Works with: MARS

and

Works with: SPIM

<lang mips> .data hello: .asciiz "Goodbye, world!"

  .text

main:

  la $a0, hello
  li $v0, 4
  syscall
  li $v0, 10
  syscall</lang>

mIRC Scripting Language

Works with: mIRC

<lang mirc>alias saygoodbye { echo -a Goodbye! }</lang>

Modula-2

<lang modula2>MODULE Hello; IMPORT InOut;

BEGIN

 InOut.WriteString('Hello World!');
 InOut.WriteLn

END Hello.</lang>

ML/I

<lang ML/I>Goodbye, World!</lang>

Modula-3

<lang modula3>MODULE Goodbye EXPORTS Main;

IMPORT IO;

BEGIN

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

END Goodbye.</lang>

MUMPS

<lang MUMPS>Write "Goodbye, World.",!</lang>

Mythryl

<lang Mythryl>print "Goodbye, World!\n";</lang>

Nemerle

<lang Nemerle> class Hello {

 static Main () : void
 {
   System.Console.WriteLine ("Hello, world!");
 }

} </lang> Easier method: <lang Nemerle> System.Console.WriteLine("Hello, world!"); </lang>

NetRexx

<lang NetRexx>say 'Goodbye, World!'</lang>

newLISP

Works with: newLisp version 6.1 and after

<lang lisp>(println "Goodbye, World!")</lang>

Nimrod

<lang python>echo("Goodbye, World!")</lang>

Node.js

<lang javascript>console.log("Goodbye, World!");</lang>

Objeck

<lang objeck>bundle Default {

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

}</lang>

Objective-C

Works with: GCC

To print to stdout: <lang objc>printf("Goodbye, World!");</lang>

To print an Objective-C NSString to stdout, here are some options: <lang objc>printf("%s", [@"Goodbye, World!" UTF8String]);</lang> <lang objc>[@"Goodbye, World!" writeToFile:@"/dev/stdout" atomically:NO encoding:NSUTF8StringEncoding error:NULL];</lang> <lang objc>[[NSFileHandle fileHandleWithStandardOutput] writeData:[@"Goodbye, World!" dataUsingEncoding:NSUTF8StringEncoding]];</lang>

To log a time-stamped message to stderr: <lang objc>NSLog(@"Goodbye, World!");</lang>

OCaml

<lang ocaml>print_endline "Goodbye, World!"</lang>

Octave

<lang octave>disp("Goodbye, world");</lang>

Or, using C-style function printf:

<lang octave>printf("Goodbye, world\n");</lang>

Onyx

<lang onyx>`Hello world!\n' print</lang>

Openscad

<lang openscad> echo("Goodbye, World!"); </lang>

Oz

<lang oz>{Show "Goodbye, World!"}</lang>

PARI/GP

<lang parigp>print("Goodbye, world!")</lang>

Pascal

Works with: Free Pascal

<lang pascal>program byeworld; begin

writeln('Goodbye, World!');

end.</lang>

PASM

<lang pasm>print "Goodbye World!\n" end</lang>

PDP-11 Assembly

Works with: UNIX version 7

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

<lang assembly>.globl start .text start:

       mov	$1,r0

sys 4; outtext; outlen sys 1 rts pc

.data outtext: <Goodbye, World!\n> outlen = . - outtext</lang>

Perl

Works with: Perl version 5.8.8

<lang perl>print "Goodbye, World!\n";</lang>

Works with: Perl version 5.10.x

Backported from Perl 6: <lang perl>use feature 'say'; say 'Goodbye, World!';</lang>

or: <lang perl>use 5.010; say 'Goodbye, World!';</lang>

Perl 6

<lang perl6>say 'Goodbye, World!';</lang>

PHP

<lang php><?php echo "Goodbye, World!\n"; ?></lang> Alternatively, any text outside of the <?php ?> tags will be automatically echoed: <lang php>Goodbye, World!</lang>

PicoLisp

<lang PicoLisp>(prinl "Goodbye, World!")</lang>

PIR

<lang pir>.sub hello_world_text :main print "Goodbye, World!\n" .end</lang>

Pike

<lang pike>int main(){

  write("Goodbye, world!\n");

}</lang>

PL/I

<lang PL/I>put ('Goodbye, World');</lang>

Pop11

<lang pop11>printf('Goodbye, World!\n');</lang>

PostScript

The "==" and "=" operators display the topmost element of the stack with or without processing, followed by a newline. Thus:

<lang postscript>(Goodbye, World!) ==</lang>

will display the string "(Goodbye, World!)" while

<lang postscript>(Goodbye, World!) =</lang>

will display the content of the string "(Goodbye, World!)"; that is, "Goodbye, World!".

To print a string without the following newline, use

<lang postscript>(Goodbye, World!) print</lang>

PowerShell

<lang powershell>Write-Host "Goodbye, World!"

  1. For extra flair, you can specify colored output

Write-Host "Goodbye, World!" -foregroundcolor red</lang>

Prolog

<lang prolog>:- write('Goodbye, World', nl).</lang>

PSQL

 EXECUTE BLOCK
   RETURNS(S VARCHAR(40))
 AS
 BEGIN
   S = 'Hello World!';
   SUSPEND;
 END

Pure

<lang pure> using system;

puts "Goodbye, World!\n" ; </lang>

PureBasic

<lang PureBasic>OpenConsole() PrintN("Goodbye, World!") Input() ; Wait for enter</lang>

Python

Works with: Python version 2.4

<lang python>print "Goodbye, World!"</lang>

The same using sys.stdout <lang python>import sys sys.stdout.write("Goodbye, World!\n")</lang>

In Python 3.0, print is being changed from a statement to a function.

Works with: Python version 3.0

<lang python>print("Goodbye, World!")</lang>

Quill

<lang quill>"Goodbye, World!" print</lang>

R

<lang R> cat("Goodbye, World!\n")</lang>

Raven

<lang raven>'Goodbye, World!' print</lang>

REALbasic

Works with: REALbasic version 5.5

This requires a console application.

<lang realbasic>Function Run(args() as String) As Integer

 Print "Goodbye, World!"
 Quit

End Function</lang>

REBOL

<lang REBOL>print "Goodbye, World!"</lang>

Retro

<lang Retro> "Goodbye, World!" puts </lang>

REXX

<lang rexx> /* goodbye program */ say 'Goodbye, World!'


/*another version:*/

call lineout ,"Goodbye, World!" </lang>

RTL/2

<lang 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;</lang>

Ruby

Works with: Ruby version 1.8.4

<lang ruby>puts "Goodbye, World!"</lang> or <lang ruby>$stdout.puts "Goodbye, World!"</lang>

SAS

<lang sas>/* Using a data step. Will print the string in the log window */ data _null_; put "Goodbye, World!"; run;</lang>

Sather

<lang sather>class GOODBYE_WORLD is

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

end;</lang>

Scala

<lang scala>println("Goodbye, World!")</lang>

Scheme

Works with: Gauche

<lang scheme>(display "Goodbye, world!") (newline)</lang> or <lang scheme>(print "Goodbye, world!")</lang>

sed

<lang sed>cGoodbye, World!</lang>

Seed7

<lang seed7>$ include "seed7_05.s7i";

const proc: main is func

 begin
   writeln("Goodbye, World!");
 end func;</lang>

Self

<lang self>'Goodbye, World!' printLine.</lang>

Shiny

<lang shiny>say 'Hello World!'</lang>

SIMPOL

<lang simpol>function main() end function "Goodbye, world!{d}{a}"</lang>

Sisal

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

 "Hello world!"

end function</lang>

Slate

<lang slate>inform: 'Goodbye, world!'.</lang>

Smalltalk

<lang smalltalk>Transcript show: 'Goodbye, world!'; cr.</lang>

Works with: GNU Smalltalk

(as does the above code)

<lang smalltalk>'Goodbye, world!' printNl.</lang>

SNOBOL4

Using CSnobol4 dialect <lang snobol4> OUTPUT = "Hello World" END</lang>

SNUSP

<lang snusp>@\G.@\o.o.@\d.--b.@\y.@\e.>@\comma.@\.<-@\W.+@\o.+++r.------l.@\d.>+.! #

|   |     \@------|#  |    \@@+@@++|+++#-    \\               -
|   \@@@@=+++++#  |   \===--------!\===!\-----|-------#-------/
\@@+@@@+++++#     \!#+++++++++++++++++++++++#!/</lang>

Standard ML

<lang sml>print "Goodbye, World!\n"</lang>

Suneido

<lang Suneido>Print("Hello World!")</lang>

Teco

Outputting to terminal. Please note that ^A means control-A, not a caret followed by 'A', and that $ represent the ESC key. <lang teco>^AGoodbye, World^A$$</lang>

Tcl

Output to terminal: <lang tcl>puts "Goodbye, World"</lang>

Output to arbitrary open, writable file: <lang tcl>puts $fileID "Goodbye, World"</lang>

TI-83 BASIC

See TI-89 BASIC.

TI-89 BASIC

<lang ti89b>Disp "Goodbye, World!"</lang>

TorqueScript

<lang tqs>echo("Goodbye, World!");</lang>

Transact-SQL

<lang sql>PRINT "Goodbye, world!"</lang>

Trith

<lang trith>"Goodbye, World!" print</lang>

TUSCRIPT

<lang tuscript> $$ MODE TUSCRIPT PRINT "hello world" text="goodbye world" PRINT text </lang> Output:

hello world
goodbye world

UNIX Shell

Works with: Bourne Shell

<lang bash>#!/bin/sh echo "Goodbye World!"</lang>

C Shell

<lang csh>#!/bin/csh -f echo "Goodbye World\!"</lang>

We use \! to prevent history substitution. Plain ! at end of string seems to be safe, but we use \! to be sure.

Unlambda

<lang unlambda>`r``````````````.G.o.o.d.b.y.e.,. .W.o.r.l.di</lang>

Ursala

output as a side effect of compilation <lang Ursala>#show+

main = -[Goodbye, World!]-</lang> output by a compiled executable <lang Ursala>#import std

  1. executable ('parameterized',)

main = <file[contents: -[Goodbye, World!]-]>!</lang>

V

<lang v>"Goodbye! world" puts</lang>

Vala

<lang vala>void main(){ stdout.printf("Hello World!\n"); }</lang>

VBScript

Works with: Windows Script Host version 5.7

<lang VBScript>WScript.Echo("Goodbye, World!")</lang>

Vedit macro language

<lang vedit>Message("Goodbye, World!")</lang>

Whenever

<lang whenever>1 print("Goodbye, world!");</lang>

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): <lang asm>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</lang>

XSLT

<lang xml><xsl:text>Goodbye, World! </xsl:text></lang>

Yorick

<lang yorick>write, "Goodbye, World!"</lang>