Hello world/Newline omission: Difference between revisions

Content deleted Content added
Bartj (talk | contribs)
Added Bracmat
Chkas (talk | contribs)
 
(317 intermediate revisions by more than 100 users not shown)
Line 1:
{{task|Basic language learning}}
 
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. The purpose of this task is to output the string "Goodbye, World!" preventing a trailing newline from occuring.
 
 
'''See also'''
;Task:
* [[Hello world/Graphical]]
Display the string &nbsp; <big><big><code>Goodbye, World!</code></big></big> &nbsp; without a trailing newline.
* [[Hello world/Line Printer]]
 
* [[Hello world/Standard error]]
 
* [[Hello world/Text]]
;Related tasks:
* &nbsp; [[Hello world/Graphical]]
* &nbsp; [[Hello world/Line Printer]]
* &nbsp; [[Hello world/Standard error]]
* &nbsp; [[Hello world/Text]]
<br><br>
 
=={{header|11l}}==
<syntaxhighlight lang="11l">print(‘Goodbye, World!’, end' ‘’)</syntaxhighlight>
 
=={{header|68000 Assembly}}==
Because assembly lets (or rather forces) the programmer to create their own print routines, new lines are not done by default.
 
Code is called as a subroutine, taking <code>A0</code> as its argument (e.g. <code>LEA myString,A0 JSR PrintString</code>). The hardware-specific <code>PrintChar</code> routine is left unimplemented.
<syntaxhighlight lang="68000devpac">PrintString:
;input: A0 = source address
;outputs to screen.
MOVE.B (A0)+,D0
BEQ Terminated
JSR PrintChar
BRA PrintString
Terminated:
; If this routine did in fact put a new line by default, it would do so here with the following:
; MOVE.B #13,D0 ;13 is ascii for Carriage Return (moves cursor back to beginning of row).
; JSR PrintChar
; MOVE.B #10,D0 ;10 is ascii for Line Feed (moves cursor down one line).
; JSR PrintChar
RTS
 
myString:
DC.B "Goodbye, World!",0
EVEN</syntaxhighlight>
 
=={{header|ACL2}}==
<syntaxhighlight lang="lisp">(cw "Goodbye, World!")</syntaxhighlight>
 
=={{header|Action!}}==
<syntaxhighlight lang="action!">PROC Main()
Print("Goodbye, World!")
RETURN</syntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Newline_omission.png Screenshot from Atari 8-bit computer]
<pre>
Goodbye, World!
</pre>
 
=={{header|Ada}}==
This example will implicitly include a final, implementation defined, terminator (usually a linefeed) if the output is a file (RM A.10.7-8) such as <code>stdout</code> on UNIX systems.
<lang ada>
<syntaxhighlight lang="ada">
with Ada.Text_IO;
 
procedure Goodbye_World is
begin
Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
</syntaxhighlight>
</lang>
Using <code>Ada.Text_IO.Text_Streams</code> instead allows us to control the termination.
<syntaxhighlight lang="ada">
with Ada.Text_IO;
with Ada.Text_IO.Text_Streams;
 
procedure Goodbye_World is
stdout: Ada.Text_IO.File_Type := Ada.Text_IO.Standard_Output;
begin
String'Write(Ada.Text_IO.Text_Streams.Stream(stdout), "Goodbye World");
end Goodbye_World;
</syntaxhighlight>
 
=={{header|Agena}}==
<syntaxhighlight lang="agena">io.write( "Goodbye, World!" )</syntaxhighlight>
 
=={{header|ALGOL 68}}==
This works with Algol68 Genie 2.8.2 and above. Earlier versions appended a gratuitous newline on unflushed output when the program terminated.
<syntaxhighlight lang="algol68">BEGIN
print ("Goodbye, World!")
END</syntaxhighlight>
 
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">prints "Goodbye, World!"</syntaxhighlight>
 
{{out}}
 
<pre>Goodbye, World!</pre>
 
=={{header|ATS}}==
<syntaxhighlight lang="ats">implement main0 () = print "Goodbye, World!"</syntaxhighlight>
 
=={{header|AutoHotkey}}==
<syntaxhighlight lang="ahk">DllCall("AllocConsole")
FileAppend, Goodbye`, World!, CONOUT$ ; No newline outputted
MsgBox</syntaxhighlight>
 
=={{header|AutoIt}}==
<syntaxhighlight lang="autoit">
ConsoleWrite("Goodbye, World!")
</syntaxhighlight>
 
=={{header|AWK}}==
<syntaxhighlight lang="awk">
BEGIN { printf("Goodbye, World!") }
</syntaxhighlight>
 
=={{header|Axe}}==
<syntaxhighlight lang="axe">Disp "Goodbye, World!"</syntaxhighlight>
 
=={{header|B}}==
{{works with|The Amsterdam Compiler Kit - B|V6.1pre1}}
<syntaxhighlight lang="b">main()
{
putstr("Goodbye, World!");
return(0);
}</syntaxhighlight>
 
=={{header|BASIC}}==
<langsyntaxhighlight lang="basic">10 REM The trailing semicolon prevents a newline
20 PRINT "Goodbye, World!";</langsyntaxhighlight>
 
==={{header|BaCon}}===
BaCon supports BASIC PRINT ending with trailing semicolon to prevent a newline and also supports a FORMAT clause that uses ''printf'' specifications and special character escapes (with no \n, there is no newline).
<syntaxhighlight lang="freebasic">PRINT "Goodbye, World!";
PRINT "Goodbye, World!" FORMAT "%s"</syntaxhighlight>
 
==={{header|Applesoft BASIC}}===
<syntaxhighlight lang="applesoftbasic">PRINT "GOODBYE, WORLD!";</syntaxhighlight>
 
==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
<syntaxhighlight lang="qbasic">print "Goodbye, World!"; '' the trailing semi-colon suppresses the new line</syntaxhighlight>
 
==={{header|Commodore BASIC}}===
<syntaxhighlight lang="basic">10 print chr$(14) : rem Switch to lower+uppercase character set
20 print "Goodbye, World!";
30 rem * If we end this program here, we will not see the effect because
40 rem BASIC will print 'READY' at a new line anyway.
50 rem * So, we just print additional message...
60 print "(End of the world)"
70 end</syntaxhighlight>
{{out}}
<pre>Goodbye, World!(End of the world)
 
ready.</pre>
 
==={{header|BASIC256}}===
Output all on a single line.
<syntaxhighlight lang="basic256">print "Goodbye,";
print " ";
print "World!";</syntaxhighlight>
 
==={{header|GW-BASIC}}===
{{works with|BASICA}}
<syntaxhighlight lang="qbasic">10 PRINT "Goodbye, World!"; '' the trailing semi-colon suppresses the new line</syntaxhighlight>
 
==={{header|IS-BASIC}}===
<syntaxhighlight lang="qbasic">10 PRINT "Goodbye, World! ";</syntaxhighlight>
 
==={{header|Minimal BASIC}}===
<syntaxhighlight lang="qbasic">10 PRINT "Goodbye, World!"; : REM the trailing semi-colon suppresses the new line
20 END</syntaxhighlight>
 
==={{header|MSX Basic}}===
<syntaxhighlight lang="qbasic">10 PRINT "Goodbye, World!"; : REM the trailing semi-colon suppresses the new line</syntaxhighlight>
 
==={{header|QBasic}}===
{{works with|FreeBASIC}}
{{works with|True BASIC}}
{{works with|Yabasic}}
A trailing semicolon prevents a newline
<syntaxhighlight lang="qbasic">PRINT "Goodbye, World!";
END</syntaxhighlight>
 
==={{header|Quite BASIC}}===
<syntaxhighlight lang="qbasic">10 PRINT "Goodbye, World!"; : REM the trailing semi-colon suppresses the new line</syntaxhighlight>
 
==={{header|True BASIC}}===
{{works with|FreeBASIC}}
{{works with|QBasic}}
{{works with|Yabasic}}
A trailing semicolon prevents a newline
<syntaxhighlight lang="qbasic">PRINT "Goodbye, World!";
END</syntaxhighlight>
 
==={{header|XBasic}}===
<syntaxhighlight lang="qbasic">PROGRAM "helloworld"
VERSION "0.0000"
 
DECLARE FUNCTION Entry ()
 
FUNCTION Entry ()
PRINT "Goodbye, World!";
END FUNCTION
END PROGRAM</syntaxhighlight>
 
==={{header|Yabasic}}===
{{works with|FreeBASIC}}
{{works with|QBasic}}
{{works with|True BASIC}}
A trailing semicolon prevents a newline
<syntaxhighlight lang="yabasic">print "Goodbye, World!";
end</syntaxhighlight>
 
=={{header|Batch File}}==
'''Under normal circumstances, when delayed expansion is disabled'''<br/>
The quoted form guarantees there are no hidden trailing spaces after World!
<syntaxhighlight lang="dos"><nul set/p"=Goodbye, World!"
<nul set/p=Goodbye, World!</syntaxhighlight>
 
'''If delayed expansion is enabled, then the ! must be escaped'''<br/>
Escape once if quoted form, twice if unquoted.
<syntaxhighlight lang="dos">setlocal enableDelayedExpansion
<nul set/p"=Goodbye, World^!"
<nul set/p=Goodbye, World^^^!</syntaxhighlight>
 
=={{header|BBC BASIC}}==
<syntaxhighlight lang="bbcbasic"> REM BBC BASIC accepts the standard trailing semicolon:
PRINT "Goodbye World!";
REM One could also output the characters individually:
GW$ = "Goodbye World!"
FOR i% = 1 TO LEN(GW$)
VDU ASCMID$(GW$, i%)
NEXT</syntaxhighlight>
 
=={{header|bc}}==
<syntaxhighlight lang="bc">"Goodbye, World!"</syntaxhighlight>
 
=={{header|beeswax}}==
<syntaxhighlight lang="beeswax">_`Goodbye, World!</syntaxhighlight>
 
beeswax prints everything without appending a newline character. beeswax has an instruction to explicitely print a newline character: <code>N</code>.
 
=={{header|Befunge}}==
In Befunge, a newline has to be explicitly output when required, so you can just not include one if it's not wanted.
 
<syntaxhighlight lang="befunge">"!dlroW ,eybdooG">:#,_@</syntaxhighlight>
 
=={{header|Binary Lambda Calculus}}==
 
Starting a program with any of the 16 ASCII characters from space to slash will copy the remainder to stdout, so for example
 
<pre>*Goodbye, World!</pre>
 
=={{header|Blade}}==
<syntaxhighlight lang="blade">print('Goodbye, World!')</syntaxhighlight>
 
=={{header|bootBASIC}}==
"Goodbye, w" and "orld!" are printed on different lines because not enough characters are allowed per line to complete this task in one line, even for the most code golfed version.
<syntaxhighlight lang="BASIC">10 print "Goodbye, w";
20 print "orld!";</syntaxhighlight>
 
=={{header|Bracmat}}==
 
<syntaxhighlight lang="bracmat">put$"Goodbye, World!"</syntaxhighlight>
 
=={{header|Brainf***}}==
One option was to copy the code from the regular Hello World version and omit the last period, but one of the nicer things about the language is that no matter how simple your program is, if it's more than a few characters long, it's probably unique. So here's yet another version of Goodbye, World in Brainf***.
<syntaxhighlight lang="bf">>+++++[>++++>+>+>++++>>+++<<<+<+<++[>++>+++>+++>++++>+>+[<]>>-]<-]>>
+.>>+..<.--.++>>+.<<+.>>>-.>++.[<]++++[>++++<-]>.>>.+++.------.<-.[>]<+.[-]
[G oo d b y e , W o r l d !]</syntaxhighlight>
 
=={{header|C}}==
In C, we do not get a newline unless we embed one:
<langsyntaxhighlight lang="c">#include <stdio.h>
#include <stdlib.h>
 
int main(int argc, char *argv[]) {
(void) printf("Goodbye, World!"); /* No automatic newline */
return EXIT_SUCCESS;
}</langsyntaxhighlight>
 
However ISO C leaves it up to implementations to define whether or not the last line of a text stream requires a new-line. This means that the C can be targetted to environments where this task is impossible to implement, at least with a direct text stream manipulation like this.
 
=={{header|C++}}==
In C++, using iostreams, portable newlines come from std::endl. Non-portable newlines may come from using constructs like \n, \r or \r\n. If we don't use any of these, we won't get a newline.
<lang cpp>#include <iostreams>
 
int main(int argc, char *argv[]) {
std::cout << "Goodbye, World!";
}</lang>
 
=={{header|C sharp|C#}}==
<langsyntaxhighlight lang="csharp">using System;
 
class Program {
{
static void Main (string[] args) {
static void Main(string[] args)
{
//Using Console.WriteLine() will append a newline
Console.WriteLine("Goodbye, World!");
Line 57 ⟶ 292:
Console.Write("Goodbye, World!");
}
}</langsyntaxhighlight>
 
=={{header|C++}}==
<syntaxhighlight lang="cpp">#include <iostream>
 
int main() {
std::cout << "Goodbye, World!";
return 0;
}</syntaxhighlight>
 
=={{header|Clipper}}==
<syntaxhighlight lang="clipper">?? "Goodbye, World!"</syntaxhighlight>
 
=={{header|Clojure}}==
<syntaxhighlight lang="clojure">(print "Goodbye, World!")</syntaxhighlight>
 
=={{header|COBOL}}==
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!' WITH NO ADVANCING.
STOP RUN.
END PROGRAM GOODBYE-WORLD.</syntaxhighlight>
 
=={{header|CoffeeScript}}==
Node JS:
<syntaxhighlight lang="coffeescript">process.stdout.write "Goodbye, World!"</syntaxhighlight>
 
=={{header|Common Lisp}}==
<syntaxhighlight lang="lisp">(princ "Goodbye, World!")</syntaxhighlight>
 
=={{header|Creative Basic}}==
<syntaxhighlight lang="creative basic">
'In a window
 
DEF Win:WINDOW
DEF Close:CHAR
DEF ScreenSizeX,ScreenSizeY:INT
GETSCREENSIZE(ScreenSizeX,ScreenSizeY)
WINDOW Win,0,0,ScreenSizeX,ScreenSizeY,0,0,"Goodbye program",MainHandler
PRINT Win,"Goodbye, World!"
'Prints in the upper left corner of the window (position 0,0).
PRINT"Win," I ride off into the sunset."
 
'There does not appear to be a means of starting a new line when printing in a window, other than by using the MOVE command.
'Therefore, both sentences here will print on the same line, i.e., in the same vertical position.
WAITUNTIL Close=1
CLOSEWINDOW Win
END
SUB MainHandler
IF @CLASS=@IDCLOSEWINDOW THEN Close=1
RETURN
 
'In the console
 
OPENCONSOLE
 
'Insert a trailing comma.
PRINT"Goodbye, World!",
PRINT" I ride off into the sunset."
 
PRINT:PRINT"Press any key to end."
 
DO:UNTIL INKEY$<>""
 
CLOSECONSOLE
 
'Since this a Cbasic console program.
END
</syntaxhighlight>
 
=={{header|D}}==
{{works with|D|2.0}}
<langsyntaxhighlight Dlang="d">import std.stdio;
 
void main() {
write("Goodbye, World!");
}</langsyntaxhighlight>
 
=={{header|EuphoriaDart}}==
<syntaxhighlight lang="dart">import 'dart:io';
<lang euphoria>-- In Euphoria puts() does not insert a newline character after outputting a string
puts(1,"Goodbye, world!")</lang>
void main() {
stdout.write("Goodbye, World!");
}</syntaxhighlight>
 
=={{header|FactorDc}}==
<syntaxhighlight lang="dc">[Goodbye, World!]P</syntaxhighlight>
<lang factor>USE: io
<syntaxhighlight lang="dc">370913249815566165486152944077005857 P</syntaxhighlight>
"Goodbye, World!" write</lang>
 
=={{header|ForthDelphi}}==
<syntaxhighlight lang="delphi">program Project1;
<lang Forth>\ The Forth word ." does not insert a newline character after outputting a string
 
." Goodbye, world!"</lang>
{$APPTYPE CONSOLE}
 
begin
Write('Goodbye, World!');
end.</syntaxhighlight>
 
=={{header|dt}}==
<syntaxhighlight lang="dt">"Goodbye, World!" p</syntaxhighlight>
 
=={{header|DWScript}}==
<syntaxhighlight lang="delphi">Print('Goodbye, World!');</syntaxhighlight>
 
=={{header|Dyalect}}==
<syntaxhighlight lang="dyalect">print("Goodbye, World!", terminator: "")</syntaxhighlight>
 
=={{header|Dylan.NET}}==
{{works with|Mono|2.6.7}}
{{works with|Mono|2.10.x}}
{{works with|Mono|3.x.y}}
{{works with|.NET|3.5}}
{{works with|.NET|4.0}}
{{works with|.NET|4.5}}
One Line version:
<syntaxhighlight lang="dylan.net">Console::Write("Goodbye, World!")</syntaxhighlight>
Goodbye World Program:
<syntaxhighlight lang="dylan.net">
//compile using the new dylan.NET v, 11.5.1.2 or later
//use mono to run the compiler
#refstdasm mscorlib.dll
 
import System
 
assembly gdbyeex exe
ver 1.2.0.0
 
class public Program
 
method public static void main()
Console::Write("Goodbye, World!")
end method
 
end class
</syntaxhighlight>
 
=={{header|Déjà Vu}}==
<syntaxhighlight lang="dejavu">!print\ "Goodbye, World!"</syntaxhighlight>
 
=={{header|EasyLang}}==
<syntaxhighlight lang=text>
# write omits newline
write "Goodbye, World!"
 
</syntaxhighlight>
 
=={{header|EchoLisp}}==
<syntaxhighlight lang="lisp">
(begin
(write "GoodBye, World")
(write "Next on same line"))
</syntaxhighlight>
 
=={{header|Elena}}==
ELENA 4.x:
<syntaxhighlight lang="elena">public program()
{
//print will not append a newline
console.write("Goodbye, World!")
}</syntaxhighlight>
 
=={{header|Elixir}}==
<syntaxhighlight lang="elixir">
IO.write "Goodbye, World!"
</syntaxhighlight>
 
=={{header|Emacs Lisp}}==
<syntaxhighlight lang="emacs lisp">(princ "Goodbye, World!")</syntaxhighlight>
 
{{out}}
 
Goodbye, World!
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">write("Goodbye, World!")</syntaxhighlight>
 
=={{header|Erlang}}==
In erlang a newline must be specified in the format string.
<syntaxhighlight lang="erlang">io:format("Goodbye, world!").</syntaxhighlight>
 
=={{header|ERRE}}==
<syntaxhighlight lang="erre">
.......
PRINT("Goodbye, World!";)
.......
</syntaxhighlight>
 
=={{header|Euphoria}}==
<syntaxhighlight lang="euphoria">-- In Euphoria puts() does not insert a newline character after outputting a string
puts(1,"Goodbye, world!")</syntaxhighlight>
 
=={{header|F Sharp|F#}}==
<langsyntaxhighlight lang="fsharp">
// A program that will run in the interpreter (fsi.exe)
printf "Goodbye, World!";;
Line 89 ⟶ 503:
printf "Goodbye, World!"
0
</syntaxhighlight>
</lang>
 
=={{header|Factor}}==
<syntaxhighlight lang="factor">USE: io
"Goodbye, World!" write</syntaxhighlight>
 
=={{header|Falcon}}==
With the print() function:
<syntaxhighlight lang="falcon">print("Goodbye, World!")</syntaxhighlight>
Or via "fast print":
<syntaxhighlight lang="falcon">>> "Goodbye, World!"</syntaxhighlight>
 
=={{header|Fantom}}==
 
<syntaxhighlight lang="java">
class Main {
Void main() {
// Print with newline
echo("Hello, World!")
// Or
Env.cur.out.printLine("Hello, World!")
 
// Print without a newline
Env.cur.out.print("Goodbye, world!")
 
// Also can get a reference to the standard output stream
out := Env.cur.out
 
out.print("Goodbye, world!")
out.flush() // and flush buffer if needed
// or method chain
out.print("Goodbye, world!").flush()
 
// Also we can an implement a user-defined method
print("Hello, world! I'm back!");
 
}
// User-defined 'print' method
private Void print(Str s) {
Env.cur.out.print(s)
}
 
}
</syntaxhighlight>
 
=={{header|FOCAL}}==
FOCAL does not insert a newline unless we specifically request one.
<syntaxhighlight lang="focal">TYPE "Goodbye, World!"</syntaxhighlight>
 
=={{header|Forth}}==
<syntaxhighlight lang="forth">\ The Forth word ." does not insert a newline character after outputting a string
." Goodbye, World!"</syntaxhighlight>
 
=={{header|Fortran}}==
<syntaxhighlight lang="fortran">program bye
write (*,'(a)',advance='no') 'Goodbye, World!'
end program bye</syntaxhighlight>
 
The "advance" facility was introduced with F90, as was the ability to specify format instructions (the <code>'(A)'</code> part) without a separate FORMAT statement. Earlier, there was a common extension:
<syntaxhighlight lang="fortran"> WRITE (6,1) "Goodbye, World!"
1 FORMAT (A,$)
END</syntaxhighlight>
In this, the FORMAT instruction is to accept alphabetic text (the A) from the WRITE statement, followed by the special $ item (of no mnemonic form) which signified that there was not to be any new line action at the end of the output. This sort of thing is useful when writing a prompt to the screen so that the input of the response appears on the same screen line. The text could also have been incorporated into the FORMAT statement, which would be useful if there were many WRITE statements scattered about that were to send forth the same text.
 
These facilities only became of interest when, instead of card decks and lineprinters, I/O involved a keyboard and screen with both input and output appearing on the same screen. Thus, in earlier Fortran usage, the issue would not arise for output to a lineprinter, because it was already the case: a line written to the lineprinter was ''not'' followed by a end-of-line/start-new-line sort of action by the lineprinter. It stayed put on the line just written. It was the ''following'' output to the lineprinter that would state "advance one" (or two, or, no) lines at the ''start'' of its output. This was the "carriage control character", and a 1 signified "skip to top-of-form" which is to say, start a new page.
 
In other words, the Fortran approach for output was <carriage control><output text> rather than the <output text><carriage control> sequence, that now has to be suppressed by the "advance = 'no'" facility.
 
=={{header|FreeBASIC}}==
<syntaxhighlight lang="basic">' FB 1.10.1 Win64
 
Print "Goodbye, World!"; ' the trailing semi-colon suppresses the new line
Sleep</syntaxhighlight>
 
=={{header|Frink}}==
<syntaxhighlight lang="frink">print["Goodbye, World!"]</syntaxhighlight>
 
 
=={{header|FutureBasic}}==
FB has several ways to suppress line feeds and/or carriage returns. A few are demonstrated here.
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"
 
print
// A semicolon will suppress a line feed in a print statement.
print "a, ";
print "b, ";
print "c"
 
print : print
 
// When logging, a \b (escaped b) appended to a string will suppress a line feed.
NSLog( @"d, \b" )
NSLog( @"e, \b" )
NSLog( @"f" )
 
long i
CFMutableStringRef mutStr
mutStr = fn MutableStringWithCapacity(0)
 
// Feeds and returns can be easily omitted using a mutable string
for i = 1 to 99
MutableStringAppendFormat( mutStr, @"%3ld, ", i )
if ( i mod 10 == 0 ) then MutableStringAppendString( mutStr, @"\n" )
if ( i == 99 ) then MutableStringAppendFormat( mutStr, @"%3ld", i + 1 )
next
 
print mutStr
 
HandleEvents
</syntaxhighlight>
{{output}}
[[File:FB Supressed Line Feed.png]]
 
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=09c8c3464c556325f089f9e4c326eaca Click this link to run this code]'''
<syntaxhighlight lang="basic">Public Sub Main()
 
Print "Goodbye, "; 'The semicolon stops the newline being added
Print "World!"
 
End</syntaxhighlight>
Output:
<pre>
Goodbye, World!
</pre>
 
=={{header|gecho}}==
<langsyntaxhighlight lang="gecho">'Hello, <> 'worldWorld! print</langsyntaxhighlight>
 
=={{header|Genie}}==
<syntaxhighlight lang="genie">[indent=4]
/*
Hello, with no newline, in Genie
valac helloNoNewline.gs
*/
 
init
stdout.printf("%s", "Goodbye, World!")</syntaxhighlight>
 
{{out}}
<pre>prompt$ valac helloNoNewline.gs
prompt$ ./helloNoNewline
Goodbye, World!prompt$</pre>
 
=={{header|GML}}==
<syntaxhighlight lang="lisp">show_message("Goodbye, World!")</syntaxhighlight>
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">package main
 
import "fmt"
 
func main() { fmt.Print("Goodbye, World!") }</langsyntaxhighlight>
 
=={{header|Groovy}}==
 
<syntaxhighlight lang="groovy">print "Goodbye, world"</syntaxhighlight>
 
=={{header|GUISS}}==
In Graphical User Interface Support Script, we specify a newline, if we want one. The following will not produce a newline:
<langsyntaxhighlight GUISSlang="guiss">Start,Programs,Accessories,Notepad,Type:Goodbye World[pling]</langsyntaxhighlight>
 
=={{header|JHarbour}}==
<syntaxhighlight lang="visualfoxpro">?? "Goodbye, world"
or
QQout( "Goodbye, world" )
</syntaxhighlight>
 
=={{header|Haskell}}==
Interpreting this task in the context of J is problematic. For example, many people use J from a browser where newlines are omitted by default. Meanwhile the J interpreter prompt always begins on a new line, so in interactive use this task becomes meaningless. Further, J provides strong tools for coalescing results and manipulating them prior to output, so newline elimination would typically happen before output rather than after.
 
<syntaxhighlight lang="haskell">main = putStr "Goodbye, world"</syntaxhighlight>
Nevertheless, <code>text 1!:3 filereference</code> will append to the referenced file without inserting any extra newlines (which might be /proc/self/stdout on linux -- though of course stdout would typically not be meaningful if J is running in the browser and is also of dubious usefulness if J is running in GTK -- still, it can be done, even if it's meaningless).
 
=={{header|HolyC}}==
So, if a J programmer were asked to solve this task, the right approach would be to ask why that is needed, and then solve the real problem instead. 1!:3 might or might not be the right answer, depending on the real issue.
<syntaxhighlight lang="holyc">"Goodbye, World!";</syntaxhighlight>
 
=={{header|HaskellIo}}==
<syntaxhighlight lang="io">
write("Goodbye, World!")
</syntaxhighlight>
 
=={{header|Huginn}}==
<lang haskell>main = putStr "Goodbye, world"</lang>
<syntaxhighlight lang="huginn">#! /bin/sh
exec huginn --no-argv -E "${0}" "${@}"
#! huginn
 
main() {
print( "Goodbye, World!" );
return ( 0 );
}</syntaxhighlight>
 
=={{header|Icon}} and {{header|Unicon}}==
Native output in Icon and Unicon is performed via the ''write'' and ''writes'' procedures. The ''write'' procedure terminates each line with both a return and newline (for consistency across platforms). The ''writes'' procedure omits this. Additionally, the programming library has a series of ''printf'' procedures as well.
<langsyntaxhighlight Iconlang="icon">procedure main()
writes("Goodbye, World!")
end</langsyntaxhighlight>
 
=={{header|IWBASIC}}==
<syntaxhighlight lang="iwbasic">
'In a window
 
DEF Win:WINDOW
DEF Close:CHAR
DEF ScreenSizeX,ScreenSizeY:UINT
GETSCREENSIZE(ScreenSizeX,ScreenSizeY)
OPENWINDOW Win,0,0,ScreenSizeX,ScreenSizeY,NULL,NULL,"Goodbye program",&MainHandler
PRINT Win,"Goodbye, World!"
'Prints in upper left corner of the window (position 0,0).
PRINT Win," You won't have this program to kick around anymore."
 
'There does not appear to be a means of starting a new line when printing in a window, other than by using the MOVE command.
'Therefore, both sentences here will print on the same line, i.e., in the same vertical position.
WAITUNTIL Close=1
CLOSEWINDOW Win
END
SUB MainHandler
IF @MESSAGE=@IDCLOSEWINDOW THEN Close=1
RETURN
ENDSUB
 
'In the console
 
OPENCONSOLE
 
'by inserting a trailing comma.
PRINT"Goodbye, World!",
PRINT" You won't have this program to kick around anymore."
 
PRINT:PRINT
 
'A press any key to continue message is automatic in a program compiled as console only.
'I presume the compiler adds the code.
CLOSECONSOLE
 
'Since this an IWBASIC console program.
END
</syntaxhighlight>
 
=={{header|J}}==
With ''jconsole'', <code>stdout</code> can be used.
<syntaxhighlight lang="j"> stdout
1!:2&4</syntaxhighlight>
<code>1!:2&4</code> returns its input unmodified. To avoid implicit output (which would repeat the output), when used interactively:
<syntaxhighlight lang="j"> put=: 0 0 $ 1!:2&4
 
put 'Goodbye, World!'
Goodbye, World!</syntaxhighlight>
However, J also works in graphical environments, which might not be connected to standard output.
'''Solution''':<code>prompt</code> from the misc package.
'''Example''':<syntaxhighlight lang="j"> load 'general/misc/prompt'
prompt 'Goodbye, World!'
Goodbye, World!</syntaxhighlight>
'''Notes''': J programs are normally run from a REPL, or session manager, which comes in several flavors. The traditional commandline-based terminal (jconsole), one of several desktop applications (jqt for the current version of J, jgtk and jwd for older versions), a web-based frontend (jhs), and various mobile apps (J for iOS, Android).
 
The specific session manager being used changes the context and therefore answer to this task. For example, when using J from a browser (including mobile browsers) newlines are omitted by default. Further, J provides strong tools for coalescing results and manipulating them prior to output, so newline elimination would typically happen before output rather than after.
 
With that said, <code>prompt</code> handles the most common cases (using binary output for jconsole, so no newline is appended; adjusting the REPL prompt in the desktop apps to to elide the newline which is normally included by default, etc).
 
For truly automated processes, you'd almost always want this kind of functionality (omitting the newline when printing) in a file- or stream-oriented application. For those cases, the simple <code>text 1!:3 file</code> will append the text to the referenced file verbatim, without inserting any extra newlines.
 
So, if a J programmer were asked to solve this task, the right approach would be to ask why that is needed, and then craft a solution appropriate to that situation.
 
=={{header|Jack}}==
<syntaxhighlight lang="jack">class Main {
function void main () {
do Output.printString("Goodbye, World!");und
return;
}
}</syntaxhighlight>
 
=={{header|Jakt}}==
<syntaxhighlight lang="jakt">
fn main() {
print("Goodbye, World!")
}
</syntaxhighlight>
 
=={{header|Janet}}==
<syntaxhighlight lang="janet">(prin "Goodbye, World!")</syntaxhighlight>
 
=={{header|Java}}==
<langsyntaxhighlight lang="java">public class HelloWorld
{
public static void main(String[] args)
Line 130 ⟶ 800:
System.out.print("Goodbye, World!");
}
}</langsyntaxhighlight>
 
=={{header|JavaScript}}==
Node JS:
<syntaxhighlight lang="javascript">process.stdout.write("Goodbye, World!");</syntaxhighlight>
 
=={{header|Joy}}==
<syntaxhighlight lang="joy">"Goodbye, World!" putchars.</syntaxhighlight>
 
=={{header|jq}}==
The "-j" command-line option suppresses the newline that would otherwise be printed, e.g. if "$" is the command-line prompt:
<syntaxhighlight lang="sh">$ jq -n -j '"Goodbye, World!"'
Goodbye, World!$ </syntaxhighlight>
The trailing "$" is the command-line prompt.
 
Similarly:
<syntaxhighlight lang="sh">$ echo '"Goodbye, World!"' | jq -j
Goodbye, World!$ </syntaxhighlight>
 
=={{header|Jsish}}==
<syntaxhighlight lang="javascript">printf("Goodbye, World!")</syntaxhighlight>
 
Evaluated from the command line as:
{{out}}
<pre>prompt$ jsish -e 'printf("Goodbye, World!")'
Goodbye, World!prompt$</pre>
 
=={{header|Julia}}==
Julia provides a <code>println</code> function which appends a newline, and a <code>print</code> function which doesn't:
<syntaxhighlight lang="julia">print("Goodbye, World!")</syntaxhighlight>
 
=={{header|Kotlin}}==
{{trans|Java}}
<syntaxhighlight lang="scala">fun main(args: Array<String>) = print("Goodbye, World!")</syntaxhighlight>
 
=={{header|Lang}}==
<syntaxhighlight lang="lang">fn.print(Goodbye, World!)</syntaxhighlight>
 
=={{header|Lasso}}==
Lasso provides a <code>stdoutnl</code> method that prints a trailing newline, and a <code>stdout</code> method that does not:
<syntaxhighlight lang="lasso">stdout("Goodbye, World!")</syntaxhighlight>
 
=={{header|LFE}}==
<syntaxhighlight lang="lisp">
(io:format "Goodbye, World")
</syntaxhighlight>
 
=={{header|Liberty BASIC}}==
A trailing semicolon prevents a newline
<langsyntaxhighlight lang="lb">print "Goodbye, World!";
</syntaxhighlight>
</lang>
 
=={{header|LIL}}==
<syntaxhighlight lang="tcl">write Goodbye, World!</syntaxhighlight>
 
=={{header|Limbo}}==
<syntaxhighlight lang="limbo">implement HelloWorld;
 
include "sys.m"; sys: Sys;
include "draw.m";
 
HelloWorld: module {
init: fn(nil: ref Draw->Context, nil: list of string);
};
 
init(nil: ref Draw->Context, nil: list of string)
{
sys = load Sys Sys->PATH;
sys->print("Goodbye, World!"); # No automatic newline.
}</syntaxhighlight>
 
=={{header|LLVM}}==
<syntaxhighlight lang="llvm">; This is not strictly LLVM, as it uses the C library function "printf".
; LLVM does not provide a way to print values, so the alternative would be
; to just load the string into memory, and that would be boring.
 
$"OUTPUT_STR" = comdat any
@"OUTPUT_STR" = linkonce_odr unnamed_addr constant [16 x i8] c"Goodbye, World!\00", comdat, align 1
 
;--- The declaration for the external C printf function.
declare i32 @printf(i8*, ...)
 
define i32 @main() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @"OUTPUT_STR", i32 0, i32 0))
ret i32 0
}</syntaxhighlight>
 
=={{header|Logtalk}}==
No action is necessary to avoid an unwanted newline.
<syntaxhighlight lang="logtalk">
:- object(error_message).
 
% the initialization/1 directive argument is automatically executed
% when the object is compiled loaded into memory:
:- initialization(write('Goodbye, World!')).
 
:- end_object.
</syntaxhighlight>
 
=={{header|Lua}}==
<syntaxhighlight lang="lua">io.write("Goodbye, World!")</syntaxhighlight>
 
=={{header|M2000 Interpreter}}==
 
<syntaxhighlight lang="m2000 interpreter">
Form 80, 45
// set no special format, 8 character column, at 0,0 position, row (top left)
Print $("", 8),@(0,0),
// semi colon
Module Test1 {
Print "Goodbye, "; 'The semicolon stops the newline being added
Print "World!"
}
// comma
Module Test2 {
Print 1,
Print 2,
Print 3,
Print // now we change line
For i=4 to 30 : Print i,: Next
// lines changed according the use of columns
}
Test1
Test2
// we can mix ; and ,
Print "aaa ";1, "bbb ";2, "ccc ";3
</syntaxhighlight>
 
 
=={{header|m4}}==
 
(Quoted) text is issued verbatim, "dnl" suppresses all input until and including the next newline. Simply creating an input without a trailing newline would of course accomplish the same task.
 
<syntaxhighlight lang="m4">`Goodbye, World!'dnl</syntaxhighlight>
 
=={{header|MANOOL}}==
<syntaxhighlight lang="manool">{{extern "manool.org.18/std/0.3/all"} in Out.Write["Goodbye, World!"]}</syntaxhighlight>
 
=={{header|Maple}}==
<syntaxhighlight lang="maple">
printf( "Goodbye, World!" );
</syntaxhighlight>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<syntaxhighlight lang="mathematica">NotebookWrite[EvaluationNotebook[], "Goodbye, World!"]</syntaxhighlight>
Another one that works in scripts:
<syntaxhighlight lang="mathematica">WriteString[$Output, "Goodbye, World!"]</syntaxhighlight>
 
=={{header|MATLAB}} / {{header|Octave}}==
<syntaxhighlight lang="matlab"> fprintf('Goodbye, World!');</syntaxhighlight>
 
=={{header|Microsoft Small Basic}}==
<syntaxhighlight lang="smallbasic">TextWindow.Write("Goodbye, World!")</syntaxhighlight>
{{out}}
<pre>Goodbye, World!Press any key to continue...</pre>
 
=={{header|min}}==
<syntaxhighlight lang="min">"Goodbye, World!" print</syntaxhighlight>
 
=={{header|mIRC Scripting Language}}==
<syntaxhighlight lang="mirc">echo -ag Goodbye, World!</syntaxhighlight>
 
=={{header|ML/I}}==
===Simple solution===
In ML/I, if there isn't a newline in the input, there won't be one in the output; so a simple solution is this (although it's hard to see that there isn't a newline).
<syntaxhighlight lang ML="ml/Ii">Goodbye, World!</langsyntaxhighlight>
===More sophisticated solution===
To make it clearer, we can define an ML/I ''skip'' to delete itself and an immediately following newline.
<langsyntaxhighlight MLlang="ml/Ii">MCSKIP " WITH " NL
Goodbye, World!""</langsyntaxhighlight>
 
=={{header|Modula-2}}==
<syntaxhighlight lang="modula2">MODULE HelloWorld;
FROM Terminal IMPORT WriteString,ReadChar;
 
BEGIN
WriteString("Goodbye, World!");
ReadChar
END HelloWorld.</syntaxhighlight>
 
=={{header|N/t/roff}}==
 
By default, /.ROFF/ replaces single non-consecutive newline characters with spaces, but considers two consecutive newline characters as a paragraph separator and omits 2-newline's worth of spaces. The former behaviour is the same as in HTML and Rosettacode's Wiki syntax: text on non-consecutive single newlines get wrapped on the same line above it. In /.ROFF/, this is the default behaviour if and only if the typesetter is processing the input in fill mode (<code>.fi</code>); though, by default, the typesetter processes in this mode anyway!
 
Because /.ROFF/ is a document formatting language, most text input is expected to be text input which will get output on paper, so there is usually no need to run a special procedure or routine to output text.
 
<syntaxhighlight lang="n/t/roff">
Goodbye, World!
</syntaxhighlight>
 
=={{header|Nanoquery}}==
<syntaxhighlight lang="nanoquery">print "Goodbye, world!"</syntaxhighlight>
 
=={{header|Neko}}==
The Neko builtin $print does not add a newline.
 
<syntaxhighlight lang="actionscript">/**
hellonnl.neko
Tectonics:
nekoc hellonnl.neko
neko hellonnl
 
-or-
 
nekoc hellonnl.neko
nekotools boot hellonnl.n
./hellonnl
*/
 
$print("Goodbye, World!");</syntaxhighlight>
 
{{out}}
<pre>prompt$ nekoc hellonnl.neko
prompt$ neko hellonnl
Goodbye, World!prompt$</pre>
 
=={{header|Nemerle}}==
 
<lang Nemerle>using System.Console;
<syntaxhighlight lang="nemerle">using System.Console;
 
module Hello
{
// as with C#, Write() does not append a newline
Write("Goodbye, world.!");
 
// equivalently
Write("Goodbye, ");
Write("world.!");
}</syntaxhighlight>
}</lang>
 
=={{header|NetRexx}}==
<syntaxhighlight lang="netrexx">/* NetRexx */
options replace format comments java crossref symbols binary
 
say 'Goodbye, World!\-'
</syntaxhighlight>
 
=={{header|NewLISP}}==
<syntaxhighlight lang="newlisp">(print "Goodbye, World!")</syntaxhighlight>
 
=={{header|Nim}}==
<syntaxhighlight lang="nim">stdout.write "Goodbye, World!"</syntaxhighlight>
 
=={{header|NS-HUBASIC}}==
<syntaxhighlight lang="ns-hubasic">10 PRINT "GOODBYE, WORLD!";</syntaxhighlight>
 
=={{header|Oberon-2}}==
<syntaxhighlight lang="oberon2">
MODULE HelloWorld;
IMPORT Out;
BEGIN
Out.String("Goodbye, world!")
END HelloWorld.
</syntaxhighlight>
 
=={{header|Objeck}}==
 
<lang objeck>
<syntaxhighlight lang="objeck">
bundle Default {
class SayHelloSayGoodbye {
function : Main(args : String[]) ~ Nil {
"HelloGoodbye, World!"->Print();
}
}
}
</syntaxhighlight>
</lang>
 
=={{header|OCaml}}==
Line 175 ⟶ 1,071:
In OCaml, the function <code>[http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALprint_endline print_endline]</code> prints a string followed by a newline character on the standard output and flush the standard output. And the function <code>[http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALprint_string print_string]</code> just prints a string with nothing additional.
 
<langsyntaxhighlight lang="ocaml">print_string "Goodbye, World!"</langsyntaxhighlight>
 
=={{header|Oforth}}==
<syntaxhighlight lang="oforth">"Goodbye, World!" print</syntaxhighlight>
 
=={{header|Ol}}==
To omit the trailing newline use `display` instead of `print`.
<syntaxhighlight lang="scheme">
(display "Goodbye, World!")
</syntaxhighlight>
 
=={{header|OOC}}==
To omit the trailing newline use print instead of println:
<syntaxhighlight lang="ooc">main: func {
"Goodbye, World!" print()
}</syntaxhighlight>
 
=={{header|Oxygene}}==
{{incorrect|Oxygene|output isn't consistent with the task's requirements: wording, capitalization.}}
 
<syntaxhighlight lang="oxygene">
namespace HelloWorld;
interface
type
HelloWorld = class
public
class method Main;
end;
implementation
class method HelloWorld.Main;
begin
Console.Write('Farewell, ');
Console.Write('cruel ');
Console.WriteLine('world!');
end;
end.
</syntaxhighlight>
<pre>
>HelloWorld.exe
Farewell, cruel world!
</pre>
 
=={{header|Panoramic}}==
<syntaxhighlight lang="panoramic">
rem insert a trailing semicolon.
print "Goodbye, World!";
print " Nice having known you."</syntaxhighlight>
 
=={{header|PARI/GP}}==
<langsyntaxhighlight lang="parigp">print1("Goodbye, World!")</langsyntaxhighlight>
 
=={{header|Pascal}}==
<syntaxhighlight lang="pascal">program NewLineOmission(output);
begin
write('Goodbye, World!');
end.</syntaxhighlight>
Output:
<pre>% ./NewLineOmission
Goodbye, World!% </pre>
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
##
Write('Goodbye, World!');
</syntaxhighlight>
 
 
=={{header|PASM}}==
 
<langsyntaxhighlight lang="pasm">print "Goodbye World!" # Newlines do not occur unless we embed them
end</langsyntaxhighlight>
 
=={{header|Perl}}==
<langsyntaxhighlight lang="perl">print "Goodbye, World!"; # A newline does not occur automatically</langsyntaxhighlight>
 
=={{header|Perl 6Phix}}==
Phix does not add '\n' automatically, except for the '?' (debugging) shorthand; if you want one you must remember to add it explicitly.
A newline is not added automatically to print or printf
<!--<syntaxhighlight lang="phix">-->
<lang perl6>print "Goodbye, World!";
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Goodbye, World!"</span><span style="color: #0000FF;">)</span>
printf "%s", "Goodbye, World!";</lang>
<!--</syntaxhighlight>-->
 
=={{header|PHL}}==
Printf doesn't add newline automatically.
 
<syntaxhighlight lang="phl">module helloworld_noln;
extern printf;
 
@Integer main [
printf("Goodbye, World!");
return 0;
]</syntaxhighlight>
 
=={{header|PHP}}==
 
<syntaxhighlight lang="php">echo "Goodbye, World !";</syntaxhighlight>
 
=={{header|Picat}}==
<syntaxhighlight lang="picat">print("Goodbye, World!")</syntaxhighlight>
 
=={{header|PicoLisp}}==
<langsyntaxhighlight PicoLisplang="picolisp">(prin "Goodbye, worldWorld!")</langsyntaxhighlight>
 
=={{header|Pict}}==
<syntaxhighlight lang="pict">(pr "Hello World!");</syntaxhighlight>
 
=={{header|Pike}}==
<syntaxhighlight lang="pike">write("Goodbye, World!");</syntaxhighlight>
 
=={{header|Pixilang}}==
<syntaxhighlight lang="pixilang">fputs("Goodbye, World!")</syntaxhighlight>
 
=={{header|PL/I}}==
<syntaxhighlight lang="pl/i">
put ('Goodbye, World!');
</syntaxhighlight>
 
=={{header|Plain English}}==
<syntaxhighlight lang="plainenglish">To run:
Start up.
Write "Goodbye, world!" on the console without advancing.
Wait for the escape key.
Shut down.</syntaxhighlight>
 
=={{header|PowerShell}}==
<syntaxhighlight lang="powershell">Write-Host -NoNewLine "Goodbye, "
Write-Host -NoNewLine "World!"</syntaxhighlight>
{{Out}}
<pre>Goodbye, World!PS C:\></pre>
 
=={{header|Processing}}==
<syntaxhighlight lang="processing">
print("Goodbye, World!"); /* No automatic newline */
</syntaxhighlight>
 
=={{header|PureBasic}}==
<langsyntaxhighlight PureBasiclang="purebasic">OpenConsole()
Print("Goodbye, World!")
Input() ;wait for enter key to be pressed</langsyntaxhighlight>
 
=={{header|Python}}==
<langsyntaxhighlight lang="python">import sys
sys.stdout.write("Goodbye, World!")</langsyntaxhighlight>
 
{{works with|Python|3.x}}
<langsyntaxhighlight lang="python">print("Goodbye, World!", end="")</langsyntaxhighlight>
 
=={{header|Quackery}}==
 
Quackery does not automatically insert a new line.
 
<syntaxhighlight lang="quackery">say "Goodbye, world!"</syntaxhighlight>
 
=={{header|R}}==
<syntaxhighlight lang="r">cat("Goodbye, world!")</syntaxhighlight>
 
=={{header|Ra}}==
<syntaxhighlight lang="ra">
class HelloWorld
**Prints "Goodbye, World!" without a new line**
 
on start
 
print "Goodbye, World!" without new line
</syntaxhighlight>
 
=={{header|Racket}}==
<syntaxhighlight lang="racket">#lang racket
(display "Goodbye, World!")</syntaxhighlight>
 
=={{header|Raku}}==
(formerly Perl 6)
A newline is not added automatically to print or printf
<syntaxhighlight lang="raku" line>print "Goodbye, World!";
printf "%s", "Goodbye, World!";</syntaxhighlight>
 
=={{header|RASEL}}==
<syntaxhighlight lang="text">"!dlroW ,olleH">:?@,Gj</syntaxhighlight>
 
=={{header|REBOL}}==
<syntaxhighlight lang="rebol">prin "Goodbye, World!"</syntaxhighlight>
 
=={{header|Red}}==
<syntaxhighlight lang="red">prin "Goodbye, World!"</syntaxhighlight>
 
=={{header|Retro}}==
<syntaxhighlight lang Retro="retro">"'Goodbye, World_World!" putss:put</langsyntaxhighlight>
 
=={{header|REXX}}==
It should be noted that upon a REXX program completion, any text left pending without a C/R (or newline) is followed by a
<br>blank line so as to not leave the state of the terminal with malformed "text lines" (which can be followed by other text
<br>(lines) from a calling program(s), or the operating system (shell) which is usually some sort of a "prompt" text string.
<syntaxhighlight lang="rexx">/*REXX pgm displays a "Goodbye, World!" without a trailing newline. */
 
call charout ,'Goodbye, World!'</syntaxhighlight>
 
=={{header|Ring}}==
<syntaxhighlight lang="ring">see "Goodbye, World!"</syntaxhighlight>
 
=={{header|Ruby}}==
<langsyntaxhighlight lang="ruby">print "Goodbye, World!"</langsyntaxhighlight>
 
=={{header|Run BASIC}}==
<syntaxhighlight lang="runbasic">print "Goodbye, World!";</syntaxhighlight>
 
=={{header|Rust}}==
<syntaxhighlight lang="rust">fn main () {
print!("Goodbye, World!");
}</syntaxhighlight>
 
=={{header|Salmon}}==
<syntaxhighlight lang="salmon">print("Goodbye, World!");</syntaxhighlight>
 
=={{header|Scala}}==
{{libheader|scala}}
===Ad hoc REPL solution===
Ad hoc solution as [http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop REPL] script. Type this in a REPL session:
<syntaxhighlight lang="scala">print("Goodbye, World!")</syntaxhighlight>
 
=={{header|Scheme}}==
<langsyntaxhighlight lang="scheme">(display "Goodbye, World!")</langsyntaxhighlight>
 
=={{header|Scilab}}==
Scilab can emulate C <code>printf</code> which, by default, does not return the carriage.
<syntaxhighlight lang="scilab">print("Goodbye, World!")</syntaxhighlight>
 
=={{header|Seed7}}==
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
const proc: main is func
begin
write("Goodbye, World!");
end func;</langsyntaxhighlight>
 
=={{header|SETL}}==
<syntaxhighlight lang="setl">nprint( 'Goodbye, World!' );</syntaxhighlight>
 
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">print "Goodbye, World!";</syntaxhighlight>
or:
<syntaxhighlight lang="ruby">"%s".printf("Goodbye, World!");</syntaxhighlight>
 
=={{header|Smalltalk}}==
<syntaxhighlight lang="smalltalk">
Transcript show: 'Goodbye, World!'.
</syntaxhighlight>
 
=={{header|Standard ML}}==
<langsyntaxhighlight lang="sml">print "Goodbye, World!"</langsyntaxhighlight>
 
=={{header|Swift}}==
{{works with|Swift|2.x+}}
<syntaxhighlight lang="swift">print("Goodbye, World!", terminator: "")</syntaxhighlight>
{{works with|Swift|1.x}}
<syntaxhighlight lang="swift">print("Goodbye, World!")</syntaxhighlight>
 
=={{header|Tcl}}==
<langsyntaxhighlight lang="tcl">puts -nonewline "Goodbye, World!"</langsyntaxhighlight>
 
=={{header|Transact-SQL}}==
{{incorrect|Transact-SQL|output isn't consistent with the task's requirements: wrong word.}}
As an output statement, PRINT always adds a new line
<syntaxhighlight lang="transact-sql"> PRINT 'Goodbye, World!'</syntaxhighlight>
or:
As a result set
<syntaxhighlight lang="transact-sql"> select 'Goodbye, World!'</syntaxhighlight>
 
=={{header|TUSCRIPT}}==
<syntaxhighlight lang="tuscript">
$$ MODE TUSCRIPT
PRINT "Goodbye, World!"
</syntaxhighlight>
Output:
<pre>
Goodbye, World!
</pre>
 
=={{header|TXR}}==
Possible using access to standard output stream via TXR Lisp:
<syntaxhighlight lang="bash">$ txr -e '(put-string "Goodbye, world!")'
Goodbye, world!$</syntaxhighlight>
 
=={{header|UNIX Shell}}==
Line 236 ⟶ 1,363:
{{works with|Bourne Shell}}
 
<langsyntaxhighlight lang="bash">printf "Goodbye, World!" # This works. There is no newline.
printf %s "-hyphens and % signs" # Use %s with arbitrary strings.</langsyntaxhighlight>
 
Unfortunately, older systems where you have to rely on vanilla Bourne shell may not have a ''printf'' command, either. It's possible that there is no command available to complete the task, but only on very old systems. For the rest, one of these two should work:
 
<langsyntaxhighlight lang="bash">echo -n 'Goodbye, World!'</langsyntaxhighlight>
or
<langsyntaxhighlight lang="bash">echo 'Goodbye, World!\c'</langsyntaxhighlight>
 
The ''print'' command, from the [[Korn Shell]], would work well, but most shells have no ''print'' command. (With [[pdksh]], ''print'' is slightly faster than ''printf'' because ''print'' runs a built-in command, but ''printf'' forks an external command. With [[ksh93]] and [[zsh]], ''print'' and ''printf'' are both built-in commands.)
Line 251 ⟶ 1,378:
{{works with|zsh}}
 
<langsyntaxhighlight lang="bash">print -n "Goodbye, World!"
print -nr -- "-hyphens and \backslashes"</langsyntaxhighlight>
 
==={{header|C Shell}}===
C Shell does support <code>echo -n</code> and omits the newline.
 
<langsyntaxhighlight lang="csh">echo -n "Goodbye, World!"
echo -n "-hyphens and \backslashes"</langsyntaxhighlight>
 
=={{header|Ursa}}==
Ursa doesn't output a newline to an I/O device by default, so simply omitting an endl object at the end of the output stream is all that's needed.
<syntaxhighlight lang="ursa">out "goodbye world!" console</syntaxhighlight>
 
=={{header|Uxntal}}==
<syntaxhighlight lang="Uxntal">|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
 
|0100
;message
&loop
LDAk .Console/write DEO
INC2 LDAk ?&loop
POP2
#80 .System/state DEO
BRK
 
@message "Goodbye, 20 "World! 00</syntaxhighlight>
 
=={{header|Vale}}==
{{works with|Vale|0.2.0}}
<syntaxhighlight lang="vale">
import stdlib.*;
 
exported func main() {
print("Goodbye, World!");
}
</syntaxhighlight>
 
=={{header|Verbexx}}==
<syntaxhighlight lang="verbexx">@STDOUT "Goodbye, World!";</syntaxhighlight>
 
=={{header|Verilog}}==
<syntaxhighlight lang="verilog">module main;
initial
begin
$write("Goodbye, World!");
$finish ;
end
endmodule</syntaxhighlight>
 
 
=={{header|Vim Script}}==
<syntaxhighlight lang="vim">echon "Goodbye, World!"</syntaxhighlight>
 
=={{header|Visual Basic .NET}}==
<syntaxhighlight lang="vbnet">Module Module1
 
Sub Main()
Console.Write("Goodbye, World!")
End Sub
 
End Module</syntaxhighlight>
 
=={{header|V (Vlang)}}==
<syntaxhighlight lang="v (vlang)">fn main() { print("Goodbye, World!") }</syntaxhighlight>
 
=={{header|Web 68}}==
{{incorrect|Web 68|output isn't consistent with the task's requirements: wording, punctuation.}}
Use the command 'tang -V hello.w68', then 'chmod +x hello.a68', then './hello.a68'
 
<syntaxhighlight lang="web68">@ @a@=#!/usr/bin/a68g -nowarn@>@\BEGIN print("Hello World") END</syntaxhighlight>
 
=={{header|Wren}}==
<syntaxhighlight lang="wren">System.write("Goodbye, World!")</syntaxhighlight>
 
=={{header|XLISP}}==
Either
<syntaxhighlight lang="scheme">(display "Goodbye, World!")</syntaxhighlight>
or
<syntaxhighlight lang="lisp">(princ "Goodbye, World!")</syntaxhighlight>
 
 
=={{header|XPath}}==
<syntaxhighlight lang="xpath">'Goodbye, World!'</syntaxhighlight>
 
=={{header|XPL0}}==
<syntaxhighlight lang="xpl0">code Text=12;
Text(0, "Goodbye, World!")</syntaxhighlight>
 
=={{header|XSLT}}==
<syntaxhighlight lang="text"><xsl:text>Goodbye, World!</xsl:text></syntaxhighlight>
 
=={{header|zkl}}==
<syntaxhighlight lang="zkl">print("Goodbye, World!");
Console.write("Goodbye, World!");</syntaxhighlight>
 
=={{header|Zig}}==
<syntaxhighlight lang="zig">const std = @import("std");
 
pub fn main() !void {
try std.io.getStdOut().writer().writeAll("Hello world!");
}</syntaxhighlight>
 
=={{header|ZX Spectrum Basic}}==
<langsyntaxhighlight lang="basic">10 REM The trailing semicolon prevents a newline
20 PRINT "Goodbye, World!";</langsyntaxhighlight>
{{omit from|PHP|lack of special newline command}}
 
{{omit from|Craft Basic|No keyword to output without newline}}
{{omit from|TXR|producing incorrect text streams is a repugnancy and not supported in this text processing tool}}
{{omit from|SQL PL|It does not provide a command to not add a new line. There is not CALL DBMS_OUTPUT.CURRENT_LINE, only CALL DBMS_OUTPUT.NEW_LINE}}