Hello world/Text

From Rosetta Code
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

360 Assembly

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

</lang>

4DOS Batch

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

6502 Assembly

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

With A86 or NASM syntax:

  org 100h

  mov dx, msg
  mov ah, 9
  int 21h

  mov ax, 4c00h
  int 21h

msg:
  db "Goodbye, World!$"

ABAP

<lang ABAP>REPORT zgoodbyeworld.

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

ACL2

<lang lisp>(cw "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>

GLBasic

<lang GLBasic>STDOUT "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>

Alore

<lang alore>Print('Goodbye, World!')</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

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: mixed case.

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

ATS

<lang ATS>implement main () = print "Goodbye, World!\n"</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>

AutoIt

<lang AutoIt>ConsoleWrite("Goodbye, World!" & @CRLF)</lang>

AWK

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


"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. <lang awk> END {

    print "Goodbye, World!"
   }

</lang>

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). <lang awk> // {

   print "Goodbye, World!" 
   exit
   }

</lang>


For a "single record" file. <lang awk> // {

   print "Goodbye, World!" 
   }

</lang>

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

Babel

<lang babel>main: { "Goodbye, 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>

BASIC256

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

Batch File

Under normal circumstances, when delayed expansion is disabled <lang dos>echo Goodbye, World!</lang>

If delayed expansion is enabled, then the ! must be escaped twice <lang dos>setlocal enableDelayedExpansion 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 Goodbye, 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

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: wording, punctuation.

The smallest Hello World source code thinkable!

<lang C0H></lang>

C1R

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: wording, punctuation.

A small Hello World program, that lists the significant part of the related task URL at the Rosetta Code web site <lang C0H>Hello_world/Text</lang>

Cat

<lang Cat>"Goodbye, World!" writeln</lang>

Cduce

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: wording.

<lang Cduce>print "Hello, World!";;</lang>

Chef

<lang 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.</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>(println "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>

ColdFusion

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: wording.

<lang coldfusion><cfoutput>Hello, World!</cfoutput></lang>

Common Lisp

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

Component Pascal

<lang oberon2> MODULE Hello; IMPORT Out;

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

Crack

<lang crack> import crack.io cout; cout `Goodbye, 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>

Dart

<lang dart>main() {

   var bye = 'Goodbye, World!';
   print("$bye");

}</lang>

dc

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

Déjà Vu

<lang dejavu>print "Goodbye, World!"</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

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: <lang Dylan.NET>Console::WriteLine("Goodbye, World!")</lang>

Hello World Program: <lang Dylan.NET> //compile using the new dylan.NET v, 11.2.8.2 or later //use mono to run the compiler

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

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: punctuation.

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>

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)

<lang eiffel>class

   HELLO_WORLD

create

   make

feature

   make
       do
           print ("Goodbye, World!%N")
       end

end</lang>

Ela

<lang ela>open console 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>

Elena VM Script

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: wording.

<lang elena>sys'vm'routines'dummy "hello" %write &nil 'program'output &wrapbatch[4] %get &nil 'program'input &wrapbatch[2] &cast[2] &nil ^eval</lang>

Elisa

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: a blank after the comma.

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

Emacs Lisp

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: punctuation.

<lang lisp>(insert "Goodbye, World")</lang>

Erlang

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

Euphoria

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

EGL

Works with: EDT
Works with: RBD

<lang EGL> program HelloWorld

   function main()
       SysLib.writeStdout("Goodbye, World!");
   end

end </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

This example is incorrect. Please fix the code and remove this message.

Details: -- The output isn't consistent with the task's requirements: punctuation, spelling of the 1st word.

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

Fexl

<lang Fexl>print "Goodbye, World!";nl;</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>

Frege

Works with: Frege version 3.20.113

<lang frege>module HelloWorld where main _ = println "Goodbye, World!"</lang>

Frink

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

Gambas

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

GAP

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

gecho

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

Gema

This example is incorrect. Please fix the code and remove this message.

Details: -- The output isn't consistent with the task's requirements: spelling of the 1st word, (also punctuation?).

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

func main() { 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+

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements (and is probably incapable of solving the task).

<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

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: mixed case.

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

Jacquard Loom

This weaves the string "Goodbye, World!" <lang jacquard>+---------------+ | | | * * | |* * * * | |* * *| |* * *| |* * * | | * * * | | * | +---------------+

+---------------+ | | |* * * | |* * * | | * *| | * *| |* * * | |* * * * | | * | +---------------+

+---------------+ | | |* ** * * | |******* *** * | | **** * * ***| | **** * ******| | ****** ** * | | * * * * | | * | +---------------+

+---------------+ | | |******* *** * | |******* *** * | | ** *| |* * * *| |******* ** * | |******* *** * | | * | +---------------+

+---------------+ | | |******* *** * | |******* *** * | | * * * *| | * * * *| |******* ** * | |******* ** * | | * | +---------------+

+---------------+ | | |***** * *** * | |******* *** * | | * * * * | | * * * | |****** ** * | |****** ** * | | * | +---------------+

+---------------+ | | | * * * | |***** * ***** | |***** ** * ***| |***** ** * ***| |******* * ** | | * * * * | | * | +---------------+

+---------------+ | | | | | * * | | * * | | * | | * | | | | | +---------------+</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('Goodbye, World!');</lang>

Works with: JScript

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

Works with: Node.js

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

JCL

<lang JCL>/*MESSAGE Goodbye, World!</lang>

Joy

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

Julia

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


Kaya

<lang kaya>program hello;

Void main() {

   // My first program!
   putStrLn("Goodbye, World!");

}</lang>

Kdf9 Usercode

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: wording, punctuation.

<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

"Goodbye, World!"|print;</lang>

KonsolScript

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

 Konsol:Log("Goodbye, 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

Function calls with either a string literal or a table constructor passed as their only argument do not require parentheses. <lang lua>print "Goodbye, World!"</lang>

M4

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

Maple

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

Mathematica

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

MATLAB

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

ans =

Goodbye, World!</lang>

Maxima

<lang maxima>print("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

<lang mirc>echo -ag Goodbye, World!</lang>

ML/I

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

Modula-2

<lang modula2>MODULE Hello; IMPORT InOut;

BEGIN

 InOut.WriteString('Goodbye, World!');
 InOut.WriteLn

END Hello.</lang>

Modula-3

<lang modula3>MODULE Goodbye EXPORTS Main;

IMPORT IO;

BEGIN

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

END Goodbye.</lang>

MUF

<lang muf>: main[ -- ] me @ "Goodbye, World!" notify exit

</lang>

MUMPS

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: punctuation.

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

Mythryl

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

Neat

<lang Neat>void main() writeln "Goodbye, World!";</lang>

Nemerle

<lang Nemerle> class Hello {

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

} </lang> Easier method: <lang Nemerle> System.Console.WriteLine("Goodbye, 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>

Oberon-2

<lang oberon2> MODULE Goodbye; IMPORT Out;

 PROCEDURE World*;
 BEGIN
   Out.String("Goodbye, World!");Out.Ln
 END World;

BEGIN

 World;

END Goodbye. </lang>

Objeck

<lang objeck> class Hello {

 function : Main(args : String[]) ~ Nil {
   "Goodbye, 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>

Occam

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: wording, punctuation.

Works with: kroc

<lang occam>#INCLUDE "course.module" PROC main (CHAN BYTE keyboard?, screen!, error!)

 out.string ("Hello World*c*n",0,screen!)
</lang>

Octave

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

Or, using C-style function printf:

<lang octave>printf("Goodbye, World!");</lang>

Onyx

<lang onyx>`Goodbye, World!\n' print</lang>

OOC

<lang ooc>main: func {

 "Goodbye, World!" println()

}</lang>

ooRexx

Refer also to the Rexx and NetRexx solutions. Simple output is common to most Rexx dialects. <lang ooRexx>/* Rexx */ say 'Goodbye, World!' </lang>

Openscad

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

Oxygene

From wp:Oxygene (programming language) <lang oxygene> namespace HelloWorld;

interface

type

 HelloClass = class
 public
   class method Main; 
 end;

implementation

class method HelloClass.Main; begin

 System.Console.WriteLine('Goodbye, World!');

end;

end. </lang>

>HelloWorld.exe
Goodbye, World!

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>

ProDOS

<lang ProDOS>printline Goodbye, World!</lang>

Prolog

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

PSQL

 EXECUTE BLOCK
   RETURNS(S VARCHAR(40))
 AS
 BEGIN
   S = 'Goodbye, 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 changed from a statement to a function.

Works with: Python version 3.0

(And version 2.X too).

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

Quill

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

R

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

Racket

<lang racket>#lang racket (display "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

using SAY

<lang rexx>/*REXX program to show a line of text. */

say 'Goodbye, World!'</lang>

using LINEOUT

<lang rexx>/*REXX program to show a line of text. */

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>

Run BASIC

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

Rust

<lang Rust>fn main() {

  io::println("Goodbye, World!");

}</lang>

Salmon

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

or

<lang Salmon>print("Goodbye, World!\n");</lang>

or

<lang Salmon>standard_output.print("Goodbye, World!\n");</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
Works with: Guile

<lang scheme>(display "Goodbye, World!") (newline)</lang>

Works with: Gauche

<lang scheme>(print "Goodbye, World!")</lang> or just: <lang scheme>"Goodbye, World!"</lang> (should work on any scheme)

sed

This example is incorrect. Please fix the code and remove this message.

Details: -- The output isn't consistent with the task's requirements: first word (spurious character?).

<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 'Goodbye, 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)

 "Goodbye, 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 = "Goodbye, 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("Goodbye, World!")</lang>

Teco

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: punctuation.

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>

TPP

<lang tpp>Goodbye, World!</lang>

TUSCRIPT

<lang tuscript> $$ MODE TUSCRIPT PRINT "Goodbye, World!" </lang> Output:

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

This example is incorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: punctuation.

<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("Goodbye, 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>

VHDL

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

XL

<lang XL> use XL.UI.CONSOLE WriteLn "Goodbye, World!" </lang>

XPL0

<lang XPL0>code Text=12; Text(0, "Goodbye, World! ")</lang>

XSLT

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

Yorick

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

Z80 Assembly

Using the Amstrad CPC firmware:

<lang z80>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"</lang>