Hello world/Newline omission: Difference between revisions

From Rosetta Code
Content added Content deleted
 
(38 intermediate revisions by 22 users not shown)
Line 16: Line 16:


=={{header|11l}}==
=={{header|11l}}==
<lang 11l>print(‘Goodbye, World!’, end' ‘’)</lang>
<syntaxhighlight lang="11l">print(‘Goodbye, World!’, end' ‘’)</syntaxhighlight>


=={{header|68000 Assembly}}==
=={{header|68000 Assembly}}==
Line 22: Line 22:


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.
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.
<lang 68000devpac>PrintString:
<syntaxhighlight lang="68000devpac">PrintString:
;input: A0 = source address
;input: A0 = source address
;outputs to screen.
;outputs to screen.
Line 39: Line 39:
myString:
myString:
DC.B "Goodbye, World!",0
DC.B "Goodbye, World!",0
EVEN</lang>
EVEN</syntaxhighlight>


=={{header|ACL2}}==
=={{header|ACL2}}==
<lang lisp>(cw "Goodbye, World!")</lang>
<syntaxhighlight lang="lisp">(cw "Goodbye, World!")</syntaxhighlight>


=={{header|Action!}}==
=={{header|Action!}}==
<lang Action!>PROC Main()
<syntaxhighlight lang="action!">PROC Main()
Print("Goodbye, World!")
Print("Goodbye, World!")
RETURN</lang>
RETURN</syntaxhighlight>
{{out}}
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Newline_omission.png Screenshot from Atari 8-bit computer]
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Newline_omission.png Screenshot from Atari 8-bit computer]
Line 56: Line 56:
=={{header|Ada}}==
=={{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.
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;
with Ada.Text_IO;


Line 63: Line 63:
Ada.Text_IO.Put("Goodbye, World!");
Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
end Goodbye_World;
</syntaxhighlight>
</lang>
Using <code>Ada.Text_IO.Text_Streams</code> instead allows us to control the termination.
Using <code>Ada.Text_IO.Text_Streams</code> instead allows us to control the termination.
<lang ada>
<syntaxhighlight lang="ada">
with Ada.Text_IO;
with Ada.Text_IO;
with Ada.Text_IO.Text_Streams;
with Ada.Text_IO.Text_Streams;
Line 74: Line 74:
String'Write(Ada.Text_IO.Text_Streams.Stream(stdout), "Goodbye World");
String'Write(Ada.Text_IO.Text_Streams.Stream(stdout), "Goodbye World");
end Goodbye_World;
end Goodbye_World;
</syntaxhighlight>
</lang>


=={{header|Agena}}==
=={{header|Agena}}==
<lang agena>io.write( "Goodbye, World!" )</lang>
<syntaxhighlight lang="agena">io.write( "Goodbye, World!" )</syntaxhighlight>


=={{header|ALGOL 68}}==
=={{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.
This works with Algol68 Genie 2.8.2 and above. Earlier versions appended a gratuitous newline on unflushed output when the program terminated.
<lang algol68>BEGIN
<syntaxhighlight lang="algol68">BEGIN
print ("Goodbye, World!")
print ("Goodbye, World!")
END</lang>
END</syntaxhighlight>


=={{header|Arturo}}==
=={{header|Arturo}}==
<lang arturo>prints "Goodbye, World!"</lang>
<syntaxhighlight lang="arturo">prints "Goodbye, World!"</syntaxhighlight>


{{out}}
{{out}}
Line 93: Line 93:


=={{header|ATS}}==
=={{header|ATS}}==
<lang ATS>implement main0 () = print "Goodbye, World!"</lang>
<syntaxhighlight lang="ats">implement main0 () = print "Goodbye, World!"</syntaxhighlight>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<lang AHK>DllCall("AllocConsole")
<syntaxhighlight lang="ahk">DllCall("AllocConsole")
FileAppend, Goodbye`, World!, CONOUT$ ; No newline outputted
FileAppend, Goodbye`, World!, CONOUT$ ; No newline outputted
MsgBox</lang>
MsgBox</syntaxhighlight>


=={{header|AutoIt}}==
=={{header|AutoIt}}==
<syntaxhighlight lang="autoit">
<lang AutoIt>
ConsoleWrite("Goodbye, World!")
ConsoleWrite("Goodbye, World!")
</syntaxhighlight>
</lang>


=={{header|AWK}}==
=={{header|AWK}}==
<syntaxhighlight lang="awk">
<lang AWK>
BEGIN { printf("Goodbye, World!") }
BEGIN { printf("Goodbye, World!") }
</syntaxhighlight>
</lang>


=={{header|Axe}}==
=={{header|Axe}}==
<lang axe>Disp "Goodbye, World!"</lang>
<syntaxhighlight lang="axe">Disp "Goodbye, World!"</syntaxhighlight>


=={{header|B}}==
=={{header|B}}==
{{works with|The Amsterdam Compiler Kit - B|V6.1pre1}}
{{works with|The Amsterdam Compiler Kit - B|V6.1pre1}}
<lang B>main()
<syntaxhighlight lang="b">main()
{
{
putstr("Goodbye, World!");
putstr("Goodbye, World!");
return(0);
return(0);
}</lang>
}</syntaxhighlight>


=={{header|BASIC}}==
=={{header|BASIC}}==
<lang basic>10 REM The trailing semicolon prevents a newline
<syntaxhighlight lang="basic">10 REM The trailing semicolon prevents a newline
20 PRINT "Goodbye, World!";</lang>
20 PRINT "Goodbye, World!";</syntaxhighlight>


==={{header|BaCon}}===
==={{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).
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).
<lang freebasic>PRINT "Goodbye, World!";
<syntaxhighlight lang="freebasic">PRINT "Goodbye, World!";
PRINT "Goodbye, World!" FORMAT "%s"</lang>
PRINT "Goodbye, World!" FORMAT "%s"</syntaxhighlight>


==={{header|Applesoft BASIC}}===
==={{header|Applesoft BASIC}}===
<lang ApplesoftBasic>PRINT "GOODBYE, WORLD!";</lang>
<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}}===
==={{header|Commodore BASIC}}===
<lang basic>10 print chr$(14) : rem Switch to lower+uppercase character set
<syntaxhighlight lang="basic">10 print chr$(14) : rem Switch to lower+uppercase character set
20 print "Goodbye, World!";
20 print "Goodbye, World!";
30 rem * If we end this program here, we will not see the effect because
30 rem * If we end this program here, we will not see the effect because
Line 140: Line 144:
50 rem * So, we just print additional message...
50 rem * So, we just print additional message...
60 print "(End of the world)"
60 print "(End of the world)"
70 end</lang>
70 end</syntaxhighlight>
{{out}}
'''Output:'''
<pre>Goodbye, World!(End of the world)
<pre>
Goodbye, World!(End of the world)


ready.
ready.</pre>
</pre>


==={{header|BASIC256}}===
==={{header|BASIC256}}===
Output all on a single line.
Output all on a single line.
<lang BASIC256>print "Goodbye,";
<syntaxhighlight lang="basic256">print "Goodbye,";
print " ";
print " ";
print "World!";</lang>
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}}===
==={{header|IS-BASIC}}===
<lang IS-BASIC>10 PRINT "Goodbye, World! ";</lang>
<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}}===
==={{header|QBasic}}===
Line 162: Line 175:
{{works with|Yabasic}}
{{works with|Yabasic}}
A trailing semicolon prevents a newline
A trailing semicolon prevents a newline
<lang qbasic>PRINT "Goodbye, World!";
<syntaxhighlight lang="qbasic">PRINT "Goodbye, World!";
END</lang>
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}}===
==={{header|True BASIC}}===
Line 170: Line 186:
{{works with|Yabasic}}
{{works with|Yabasic}}
A trailing semicolon prevents a newline
A trailing semicolon prevents a newline
<lang qbasic>PRINT "Goodbye, World!";
<syntaxhighlight lang="qbasic">PRINT "Goodbye, World!";
END</lang>
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}}===
==={{header|Yabasic}}===
Line 178: Line 205:
{{works with|True BASIC}}
{{works with|True BASIC}}
A trailing semicolon prevents a newline
A trailing semicolon prevents a newline
<lang yabasic>print "Goodbye, World!";
<syntaxhighlight lang="yabasic">print "Goodbye, World!";
end</lang>
end</syntaxhighlight>


=={{header|Batch File}}==
=={{header|Batch File}}==
'''Under normal circumstances, when delayed expansion is disabled'''<br/>
'''Under normal circumstances, when delayed expansion is disabled'''<br/>
The quoted form guarantees there are no hidden trailing spaces after World!
The quoted form guarantees there are no hidden trailing spaces after World!
<lang dos><nul set/p"=Goodbye, World!"
<syntaxhighlight lang="dos"><nul set/p"=Goodbye, World!"
<nul set/p=Goodbye, World!</lang>
<nul set/p=Goodbye, World!</syntaxhighlight>


'''If delayed expansion is enabled, then the ! must be escaped'''<br/>
'''If delayed expansion is enabled, then the ! must be escaped'''<br/>
Escape once if quoted form, twice if unquoted.
Escape once if quoted form, twice if unquoted.
<lang dos>setlocal enableDelayedExpansion
<syntaxhighlight lang="dos">setlocal enableDelayedExpansion
<nul set/p"=Goodbye, World^!"
<nul set/p"=Goodbye, World^!"
<nul set/p=Goodbye, World^^^!</lang>
<nul set/p=Goodbye, World^^^!</syntaxhighlight>


=={{header|BBC BASIC}}==
=={{header|BBC BASIC}}==
<lang bbcbasic> REM BBC BASIC accepts the standard trailing semicolon:
<syntaxhighlight lang="bbcbasic"> REM BBC BASIC accepts the standard trailing semicolon:
PRINT "Goodbye World!";
PRINT "Goodbye World!";
Line 201: Line 228:
FOR i% = 1 TO LEN(GW$)
FOR i% = 1 TO LEN(GW$)
VDU ASCMID$(GW$, i%)
VDU ASCMID$(GW$, i%)
NEXT</lang>
NEXT</syntaxhighlight>


=={{header|Bc}}==
=={{header|bc}}==
<lang Bc>print "Goodbye, World!"</lang>
<syntaxhighlight lang="bc">"Goodbye, World!"</syntaxhighlight>


=={{header|beeswax}}==
=={{header|beeswax}}==
<lang beeswax>_`Goodbye, World!</lang>
<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>.
beeswax prints everything without appending a newline character. beeswax has an instruction to explicitely print a newline character: <code>N</code>.
Line 214: Line 241:
In Befunge, a newline has to be explicitly output when required, so you can just not include one if it's not wanted.
In Befunge, a newline has to be explicitly output when required, so you can just not include one if it's not wanted.


<lang befunge>"!dlroW ,eybdooG">:#,_@</lang>
<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}}==
=={{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.
"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.
<lang bootBASIC>10 print "Goodbye, w";
<syntaxhighlight lang="BASIC">10 print "Goodbye, w";
20 print "orld!";</lang>
20 print "orld!";</syntaxhighlight>


=={{header|Bracmat}}==
=={{header|Bracmat}}==


<lang bracmat>put$"Goodbye, World!"</lang>
<syntaxhighlight lang="bracmat">put$"Goodbye, World!"</syntaxhighlight>


=={{header|Brainf***}}==
=={{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***.
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***.
<lang bf>>+++++[>++++>+>+>++++>>+++<<<+<+<++[>++>+++>+++>++++>+>+[<]>>-]<-]>>
<syntaxhighlight lang="bf">>+++++[>++++>+>+>++++>>+++<<<+<+<++[>++>+++>+++>++++>+>+[<]>>-]<-]>>
+.>>+..<.--.++>>+.<<+.>>>-.>++.[<]++++[>++++<-]>.>>.+++.------.<-.[>]<+.[-]
+.>>+..<.--.++>>+.<<+.>>>-.>++.[<]++++[>++++<-]>.>>.+++.------.<-.[>]<+.[-]
[G oo d b y e , W o r l d !]</lang>
[G oo d b y e , W o r l d !]</syntaxhighlight>


=={{header|C}}==
=={{header|C}}==
In C, we do not get a newline unless we embed one:
In C, we do not get a newline unless we embed one:
<lang c>#include <stdio.h>
<syntaxhighlight lang="c">#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>


Line 239: Line 275:
(void) printf("Goodbye, World!"); /* No automatic newline */
(void) printf("Goodbye, World!"); /* No automatic newline */
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}</lang>
}</syntaxhighlight>


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.
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 sharp|C#}}==
=={{header|C sharp|C#}}==
<lang csharp>using System;
<syntaxhighlight lang="csharp">using System;


class Program
class Program
Line 256: Line 292:
Console.Write("Goodbye, World!");
Console.Write("Goodbye, World!");
}
}
}</lang>
}</syntaxhighlight>


=={{header|C++}}==
=={{header|C++}}==
<lang cpp>#include <iostream>
<syntaxhighlight lang="cpp">#include <iostream>


int main() {
int main() {
std::cout << "Goodbye, World!";
std::cout << "Goodbye, World!";
return 0;
return 0;
}</lang>
}</syntaxhighlight>


=={{header|Clipper}}==
=={{header|Clipper}}==
<lang Clipper>?? "Goodbye, World!"</lang>
<syntaxhighlight lang="clipper">?? "Goodbye, World!"</syntaxhighlight>


=={{header|Clojure}}==
=={{header|Clojure}}==
<lang clojure>(print "Goodbye, World!")</lang>
<syntaxhighlight lang="clojure">(print "Goodbye, World!")</syntaxhighlight>


=={{header|COBOL}}==
=={{header|COBOL}}==
<lang cobol>IDENTIFICATION DIVISION.
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.
PROGRAM-ID. GOODBYE-WORLD.
PROCEDURE DIVISION.

DISPLAY 'Goodbye, World!' WITH NO ADVANCING.
PROCEDURE DIVISION.
STOP RUN.
DISPLAY 'Goodbye, World!'
END PROGRAM GOODBYE-WORLD.</syntaxhighlight>
WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.</lang>


=={{header|CoffeeScript}}==
=={{header|CoffeeScript}}==
Node JS:
Node JS:
<lang coffeescript>process.stdout.write "Goodbye, World!"</lang>
<syntaxhighlight lang="coffeescript">process.stdout.write "Goodbye, World!"</syntaxhighlight>


=={{header|Common Lisp}}==
=={{header|Common Lisp}}==
<lang lisp>(princ "Goodbye, World!")</lang>
<syntaxhighlight lang="lisp">(princ "Goodbye, World!")</syntaxhighlight>


=={{header|Creative Basic}}==
=={{header|Creative Basic}}==
<syntaxhighlight lang="creative basic">
<lang Creative Basic>
'In a window
'In a window


Line 337: Line 370:
'Since this a Cbasic console program.
'Since this a Cbasic console program.
END
END
</syntaxhighlight>
</lang>


=={{header|D}}==
=={{header|D}}==
{{works with|D|2.0}}
{{works with|D|2.0}}
<lang D>import std.stdio;
<syntaxhighlight lang="d">import std.stdio;


void main() {
void main() {
write("Goodbye, World!");
write("Goodbye, World!");
}</lang>
}</syntaxhighlight>

=={{header|Dart}}==
<syntaxhighlight lang="dart">import 'dart:io';
void main() {
stdout.write("Goodbye, World!");
}</syntaxhighlight>


=={{header|Dc}}==
=={{header|Dc}}==
<lang Dc>[Goodbye, World!]P</lang>
<syntaxhighlight lang="dc">[Goodbye, World!]P</syntaxhighlight>
<lang Dc>370913249815566165486152944077005857 P</lang>
<syntaxhighlight lang="dc">370913249815566165486152944077005857 P</syntaxhighlight>


=={{header|Delphi}}==
=={{header|Delphi}}==
<lang Delphi>program Project1;
<syntaxhighlight lang="delphi">program Project1;


{$APPTYPE CONSOLE}
{$APPTYPE CONSOLE}
Line 358: Line 398:
begin
begin
Write('Goodbye, World!');
Write('Goodbye, World!');
end.</lang>
end.</syntaxhighlight>

=={{header|dt}}==
<syntaxhighlight lang="dt">"Goodbye, World!" p</syntaxhighlight>


=={{header|DWScript}}==
=={{header|DWScript}}==
<lang Delphi>Print('Goodbye, World!');</lang>
<syntaxhighlight lang="delphi">Print('Goodbye, World!');</syntaxhighlight>


=={{header|Dyalect}}==
=={{header|Dyalect}}==
<lang Dyalect>print("Goodbye, World!", terminator: "")</lang>
<syntaxhighlight lang="dyalect">print("Goodbye, World!", terminator: "")</syntaxhighlight>


=={{header|Dylan.NET}}==
=={{header|Dylan.NET}}==
Line 374: Line 417:
{{works with|.NET|4.5}}
{{works with|.NET|4.5}}
One Line version:
One Line version:
<lang Dylan.NET>Console::Write("Goodbye, World!")</lang>
<syntaxhighlight lang="dylan.net">Console::Write("Goodbye, World!")</syntaxhighlight>
Goodbye World Program:
Goodbye World Program:
<syntaxhighlight lang="dylan.net">
<lang Dylan.NET>
//compile using the new dylan.NET v, 11.5.1.2 or later
//compile using the new dylan.NET v, 11.5.1.2 or later
//use mono to run the compiler
//use mono to run the compiler
Line 393: Line 436:


end class
end class
</syntaxhighlight>
</lang>


=={{header|Déjà Vu}}==
=={{header|Déjà Vu}}==
<lang dejavu>!print\ "Goodbye, World!"</lang>
<syntaxhighlight lang="dejavu">!print\ "Goodbye, World!"</syntaxhighlight>

=={{header|EasyLang}}==
<syntaxhighlight>
# write omits newline
write "Goodbye, World!"

</syntaxhighlight>


=={{header|EchoLisp}}==
=={{header|EchoLisp}}==
<lang lisp>
<syntaxhighlight lang="lisp">
(begin
(begin
(write "GoodBye, World")
(write "GoodBye, World")
(write "Next on same line"))
(write "Next on same line"))
</syntaxhighlight>
</lang>


=={{header|Elena}}==
=={{header|Elena}}==
ELENA 4.x:
ELENA 4.x:
<lang elena>public program()
<syntaxhighlight lang="elena">public program()
{
{
//print will not append a newline
//print will not append a newline
console.write("Goodbye, World!")
console.write("Goodbye, World!")
}</lang>
}</syntaxhighlight>


=={{header|Elixir}}==
=={{header|Elixir}}==
<lang elixir>
<syntaxhighlight lang="elixir">
IO.write "Goodbye, World!"
IO.write "Goodbye, World!"
</syntaxhighlight>
</lang>


=={{header|Emacs Lisp}}==
=={{header|Emacs Lisp}}==
<lang Emacs Lisp>(princ "Goodbye, World!")</lang>
<syntaxhighlight lang="emacs lisp">(princ "Goodbye, World!")</syntaxhighlight>


{{out}}
{{out}}


Goodbye, World!
Goodbye, World!

=={{header|EMal}}==
<syntaxhighlight lang="emal">write("Goodbye, World!")</syntaxhighlight>


=={{header|Erlang}}==
=={{header|Erlang}}==
In erlang a newline must be specified in the format string.
In erlang a newline must be specified in the format string.
<lang erlang>io:format("Goodbye, world!").</lang>
<syntaxhighlight lang="erlang">io:format("Goodbye, world!").</syntaxhighlight>


=={{header|ERRE}}==
=={{header|ERRE}}==
<syntaxhighlight lang="erre">
<lang ERRE>
.......
.......
PRINT("Goodbye, World!";)
PRINT("Goodbye, World!";)
.......
.......
</syntaxhighlight>
</lang>


=={{header|Euphoria}}==
=={{header|Euphoria}}==
<lang euphoria>-- In Euphoria puts() does not insert a newline character after outputting a string
<syntaxhighlight lang="euphoria">-- In Euphoria puts() does not insert a newline character after outputting a string
puts(1,"Goodbye, world!")</lang>
puts(1,"Goodbye, world!")</syntaxhighlight>


=={{header|F Sharp|F#}}==
=={{header|F Sharp|F#}}==
<lang fsharp>
<syntaxhighlight lang="fsharp">
// A program that will run in the interpreter (fsi.exe)
// A program that will run in the interpreter (fsi.exe)
printf "Goodbye, World!";;
printf "Goodbye, World!";;
Line 450: Line 503:
printf "Goodbye, World!"
printf "Goodbye, World!"
0
0
</syntaxhighlight>
</lang>


=={{header|Factor}}==
=={{header|Factor}}==
<lang factor>USE: io
<syntaxhighlight lang="factor">USE: io
"Goodbye, World!" write</lang>
"Goodbye, World!" write</syntaxhighlight>


=={{header|Falcon}}==
=={{header|Falcon}}==
With the print() function:
With the print() function:
<lang falcon>print("Goodbye, World!")</lang>
<syntaxhighlight lang="falcon">print("Goodbye, World!")</syntaxhighlight>
Or via "fast print":
Or via "fast print":
<lang falcon>>> "Goodbye, World!"</lang>
<syntaxhighlight lang="falcon">>> "Goodbye, World!"</syntaxhighlight>


=={{header|Fantom}}==
=={{header|Fantom}}==


<syntaxhighlight lang="java">
<lang fantom>
class Main {
class Main {
Void main() {
Void main() {
// Print with newline
echo("Goodbye, World!")
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>
</lang>


=={{header|FOCAL}}==
=={{header|FOCAL}}==
FOCAL does not insert a newline unless we specifically request one.
FOCAL does not insert a newline unless we specifically request one.
<lang focal>TYPE "Goodbye, World!"</lang>
<syntaxhighlight lang="focal">TYPE "Goodbye, World!"</syntaxhighlight>


=={{header|Forth}}==
=={{header|Forth}}==
<lang Forth>\ The Forth word ." does not insert a newline character after outputting a string
<syntaxhighlight lang="forth">\ The Forth word ." does not insert a newline character after outputting a string
." Goodbye, World!"</lang>
." Goodbye, World!"</syntaxhighlight>


=={{header|Fortran}}==
=={{header|Fortran}}==
<lang Fortran>program bye
<syntaxhighlight lang="fortran">program bye
write (*,'(a)',advance='no') 'Goodbye, World!'
write (*,'(a)',advance='no') 'Goodbye, World!'
end program bye</lang>
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:
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:
<lang Fortran> WRITE (6,1) "Goodbye, World!"
<syntaxhighlight lang="fortran"> WRITE (6,1) "Goodbye, World!"
1 FORMAT (A,$)
1 FORMAT (A,$)
END</lang>
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.
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.


Line 496: Line 573:


=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64
<syntaxhighlight lang="basic">' FB 1.10.1 Win64


Print "Goodbye, World!"; '' the trailing semi-colon suppresses the new line
Print "Goodbye, World!"; ' the trailing semi-colon suppresses the new line
Sleep</lang>
Sleep</syntaxhighlight>


=={{header|Frink}}==
=={{header|Frink}}==
<lang Frink>print["Goodbye, World!"]</lang>
<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}}==
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=09c8c3464c556325f089f9e4c326eaca Click this link to run this code]'''
'''[https://gambas-playground.proko.eu/?gist=09c8c3464c556325f089f9e4c326eaca Click this link to run this code]'''
<lang gambas>Public Sub Main()
<syntaxhighlight lang="basic">Public Sub Main()


Print "Goodbye, "; 'The semicolon stops the newline being added
Print "Goodbye, "; 'The semicolon stops the newline being added
Print "World!"
Print "World!"


End</lang>
End</syntaxhighlight>
Output:
Output:
<pre>
<pre>
Line 518: Line 632:


=={{header|gecho}}==
=={{header|gecho}}==
<lang gecho>'Hello, <> 'World! print</lang>
<syntaxhighlight lang="gecho">'Hello, <> 'World! print</syntaxhighlight>


=={{header|Genie}}==
=={{header|Genie}}==
<lang genie>[indent=4]
<syntaxhighlight lang="genie">[indent=4]
/*
/*
Hello, with no newline, in Genie
Hello, with no newline, in Genie
Line 528: Line 642:


init
init
stdout.printf("%s", "Goodbye, World!")</lang>
stdout.printf("%s", "Goodbye, World!")</syntaxhighlight>


{{out}}
{{out}}
Line 536: Line 650:


=={{header|GML}}==
=={{header|GML}}==
<lang lisp>show_message("Goodbye, World!")</lang>
<syntaxhighlight lang="lisp">show_message("Goodbye, World!")</syntaxhighlight>


=={{header|Go}}==
=={{header|Go}}==
<lang go>package main
<syntaxhighlight lang="go">package main


import "fmt"
import "fmt"


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


=={{header|Groovy}}==
=={{header|Groovy}}==


<lang groovy>print "Goodbye, world"</lang>
<syntaxhighlight lang="groovy">print "Goodbye, world"</syntaxhighlight>


=={{header|GUISS}}==
=={{header|GUISS}}==
In Graphical User Interface Support Script, we specify a newline, if we want one. The following will not produce a newline:
In Graphical User Interface Support Script, we specify a newline, if we want one. The following will not produce a newline:
<lang GUISS>Start,Programs,Accessories,Notepad,Type:Goodbye World[pling]</lang>
<syntaxhighlight lang="guiss">Start,Programs,Accessories,Notepad,Type:Goodbye World[pling]</syntaxhighlight>


=={{header|Harbour}}==
=={{header|Harbour}}==
<lang visualfoxpro>?? "Goodbye, world"
<syntaxhighlight lang="visualfoxpro">?? "Goodbye, world"
or
or
QQout( "Goodbye, world" )
QQout( "Goodbye, world" )
</syntaxhighlight>
</lang>


=={{header|Haskell}}==
=={{header|Haskell}}==


<lang haskell>main = putStr "Goodbye, world"</lang>
<syntaxhighlight lang="haskell">main = putStr "Goodbye, world"</syntaxhighlight>


=={{header|HolyC}}==
=={{header|HolyC}}==
<lang holyc>"Goodbye, World!";</lang>
<syntaxhighlight lang="holyc">"Goodbye, World!";</syntaxhighlight>


=={{header|Io}}==
=={{header|Io}}==
<syntaxhighlight lang="io">
<lang io>
write("Goodbye, World!")
write("Goodbye, World!")
</syntaxhighlight>
</lang>


=={{header|Huginn}}==
=={{header|Huginn}}==
<lang huginn>#! /bin/sh
<syntaxhighlight lang="huginn">#! /bin/sh
exec huginn --no-argv -E "${0}" "${@}"
exec huginn --no-argv -E "${0}" "${@}"
#! huginn
#! huginn
Line 579: Line 693:
print( "Goodbye, World!" );
print( "Goodbye, World!" );
return ( 0 );
return ( 0 );
}</lang>
}</syntaxhighlight>


=={{header|Icon}} and {{header|Unicon}}==
=={{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.
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.
<lang Icon>procedure main()
<syntaxhighlight lang="icon">procedure main()
writes("Goodbye, World!")
writes("Goodbye, World!")
end</lang>
end</syntaxhighlight>


=={{header|IWBASIC}}==
=={{header|IWBASIC}}==
<syntaxhighlight lang="iwbasic">
<lang IWBASIC>
'In a window
'In a window


Line 635: Line 749:
'Since this an IWBASIC console program.
'Since this an IWBASIC console program.
END
END
</syntaxhighlight>
</lang>


=={{header|J}}==
=={{header|J}}==
With ''jconsole'', <code>stdout</code> can be used.
On a linux system, you can use 1!:3 because stdout is a file:
<syntaxhighlight lang="j"> stdout
<lang j> 'Goodbye, World!' 1!:3 <'/proc/self/fd/1'
1!:2&4</syntaxhighlight>
Goodbye, World! </lang>
<code>1!:2&4</code> returns its input unmodified. To avoid implicit output (which would repeat the output), when used interactively:
However, J works in environments other than Linux, so...
<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.
'''Solution''':<code>prompt</code> from the misc package.
'''Example''':<lang j> load 'general/misc/prompt'
'''Example''':<syntaxhighlight lang="j"> load 'general/misc/prompt'
prompt 'Goodbye, World!'
prompt 'Goodbye, World!'
Goodbye, World!</lang>
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 but still supported versions), a web-based frontend (jhs), and various mobile apps (J for iOS, Android).
'''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.
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).
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.
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.
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}}==
=={{header|Jack}}==
<lang jack>class Main {
<syntaxhighlight lang="jack">class Main {
function void main () {
function void main () {
do Output.printString("Goodbye, World!");und
do Output.printString("Goodbye, World!");und
return;
return;
}
}
}</lang>
}</syntaxhighlight>

=={{header|Jakt}}==
<syntaxhighlight lang="jakt">
fn main() {
print("Goodbye, World!")
}
</syntaxhighlight>


=={{header|Janet}}==
=={{header|Janet}}==
<lang janet>(prin "Goodbye, World!")</lang>
<syntaxhighlight lang="janet">(prin "Goodbye, World!")</syntaxhighlight>


=={{header|Java}}==
=={{header|Java}}==
<lang java>public class HelloWorld
<syntaxhighlight lang="java">public class HelloWorld
{
{
public static void main(String[] args)
public static void main(String[] args)
Line 674: Line 800:
System.out.print("Goodbye, World!");
System.out.print("Goodbye, World!");
}
}
}</lang>
}</syntaxhighlight>


=={{header|JavaScript}}==
=={{header|JavaScript}}==
Node JS:
Node JS:
<lang javascript>process.stdout.write("Goodbye, World!");</lang>
<syntaxhighlight lang="javascript">process.stdout.write("Goodbye, World!");</syntaxhighlight>

=={{header|Joy}}==
<syntaxhighlight lang="joy">"Goodbye, World!" putchars.</syntaxhighlight>


=={{header|jq}}==
=={{header|jq}}==
The "-j" command-line option suppresses the newline that would otherwise be printed, e.g. if "$" is the command-line prompt:
The "-j" command-line option suppresses the newline that would otherwise be printed, e.g. if "$" is the command-line prompt:
<lang sh>$ jq -n -j '"Goodbye, World!"'
<syntaxhighlight lang="sh">$ jq -n -j '"Goodbye, World!"'
Goodbye, World!$ </lang>
Goodbye, World!$ </syntaxhighlight>
The trailing "$" is the command-line prompt.
The trailing "$" is the command-line prompt.


Similarly:
Similarly:
<lang sh>$ echo '"Goodbye, World!"' | jq -j
<syntaxhighlight lang="sh">$ echo '"Goodbye, World!"' | jq -j
Goodbye, World!$ </lang>
Goodbye, World!$ </syntaxhighlight>


=={{header|Jsish}}==
=={{header|Jsish}}==
<lang javascript>printf("Goodbye, World!")</lang>
<syntaxhighlight lang="javascript">printf("Goodbye, World!")</syntaxhighlight>


Evaluated from the command line as:
Evaluated from the command line as:
Line 700: Line 829:
=={{header|Julia}}==
=={{header|Julia}}==
Julia provides a <code>println</code> function which appends a newline, and a <code>print</code> function which doesn't:
Julia provides a <code>println</code> function which appends a newline, and a <code>print</code> function which doesn't:
<lang julia>print("Goodbye, World!")</lang>
<syntaxhighlight lang="julia">print("Goodbye, World!")</syntaxhighlight>


=={{header|Kotlin}}==
=={{header|Kotlin}}==
{{trans|Java}}
{{trans|Java}}
<lang scala>fun main(args: Array<String>) = print("Goodbye, World!")</lang>
<syntaxhighlight lang="scala">fun main(args: Array<String>) = print("Goodbye, World!")</syntaxhighlight>

=={{header|Lang}}==
<syntaxhighlight lang="lang">fn.print(Goodbye, World!)</syntaxhighlight>


=={{header|Lasso}}==
=={{header|Lasso}}==
Lasso provides a <code>stdoutnl</code> method that prints a trailing newline, and a <code>stdout</code> method that does not:
Lasso provides a <code>stdoutnl</code> method that prints a trailing newline, and a <code>stdout</code> method that does not:
<lang lasso>stdout("Goodbye, World!")</lang>
<syntaxhighlight lang="lasso">stdout("Goodbye, World!")</syntaxhighlight>


=={{header|LFE}}==
=={{header|LFE}}==
<lang lisp>
<syntaxhighlight lang="lisp">
(io:format "Goodbye, World")
(io:format "Goodbye, World")
</syntaxhighlight>
</lang>


=={{header|Liberty BASIC}}==
=={{header|Liberty BASIC}}==
A trailing semicolon prevents a newline
A trailing semicolon prevents a newline
<lang lb>print "Goodbye, World!";
<syntaxhighlight lang="lb">print "Goodbye, World!";
</syntaxhighlight>
</lang>


=={{header|LIL}}==
=={{header|LIL}}==
<lang tcl>write Goodbye, World!</lang>
<syntaxhighlight lang="tcl">write Goodbye, World!</syntaxhighlight>


=={{header|Limbo}}==
=={{header|Limbo}}==
<lang limbo>implement HelloWorld;
<syntaxhighlight lang="limbo">implement HelloWorld;


include "sys.m"; sys: Sys;
include "sys.m"; sys: Sys;
Line 737: Line 869:
sys = load Sys Sys->PATH;
sys = load Sys Sys->PATH;
sys->print("Goodbye, World!"); # No automatic newline.
sys->print("Goodbye, World!"); # No automatic newline.
}</lang>
}</syntaxhighlight>


=={{header|LLVM}}==
=={{header|LLVM}}==
<lang llvm>; This is not strictly LLVM, as it uses the C library function "printf".
<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
; 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.
; to just load the string into memory, and that would be boring.
Line 753: Line 885:
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @"OUTPUT_STR", i32 0, i32 0))
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @"OUTPUT_STR", i32 0, i32 0))
ret i32 0
ret i32 0
}</lang>
}</syntaxhighlight>


=={{header|Logtalk}}==
=={{header|Logtalk}}==
No action is necessary to avoid an unwanted newline.
No action is necessary to avoid an unwanted newline.
<lang logtalk>
<syntaxhighlight lang="logtalk">
:- object(error_message).
:- object(error_message).


Line 765: Line 897:


:- end_object.
:- end_object.
</syntaxhighlight>
</lang>


=={{header|Lua}}==
=={{header|Lua}}==
<lang lua>io.write("Goodbye, World!")</lang>
<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}}==
=={{header|m4}}==
Line 774: Line 933:
(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.
(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.


<lang m4>`Goodbye, World!'dnl</lang>
<syntaxhighlight lang="m4">`Goodbye, World!'dnl</syntaxhighlight>


=={{header|MANOOL}}==
=={{header|MANOOL}}==
<lang MANOOL>{{extern "manool.org.18/std/0.3/all"} in Out.Write["Goodbye, World!"]}</lang>
<syntaxhighlight lang="manool">{{extern "manool.org.18/std/0.3/all"} in Out.Write["Goodbye, World!"]}</syntaxhighlight>


=={{header|Maple}}==
=={{header|Maple}}==
<syntaxhighlight lang="maple">
<lang Maple>
printf( "Goodbye, World!" );
printf( "Goodbye, World!" );
</syntaxhighlight>
</lang>


=={{header|Mathematica}} / {{header|Wolfram Language}}==
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<lang Mathematica>NotebookWrite[EvaluationNotebook[], "Goodbye, World!"]</lang>
<syntaxhighlight lang="mathematica">NotebookWrite[EvaluationNotebook[], "Goodbye, World!"]</syntaxhighlight>
Another one that works in scripts:
Another one that works in scripts:
<lang Mathematica>WriteString[$Output, "Goodbye, World!"]</lang>
<syntaxhighlight lang="mathematica">WriteString[$Output, "Goodbye, World!"]</syntaxhighlight>


=={{header|MATLAB}} / {{header|Octave}}==
=={{header|MATLAB}} / {{header|Octave}}==
<lang Matlab> fprintf('Goodbye, World!');</lang>
<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}}==
=={{header|min}}==
<lang min>"Goodbye, World!" print</lang>
<syntaxhighlight lang="min">"Goodbye, World!" print</syntaxhighlight>


=={{header|mIRC Scripting Language}}==
=={{header|mIRC Scripting Language}}==
<lang mirc>echo -ag Goodbye, World!</lang>
<syntaxhighlight lang="mirc">echo -ag Goodbye, World!</syntaxhighlight>


=={{header|ML/I}}==
=={{header|ML/I}}==
===Simple solution===
===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).
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).
<lang ML/I>Goodbye, World!</lang>
<syntaxhighlight lang="ml/i">Goodbye, World!</syntaxhighlight>
===More sophisticated solution===
===More sophisticated solution===
To make it clearer, we can define an ML/I ''skip'' to delete itself and an immediately following newline.
To make it clearer, we can define an ML/I ''skip'' to delete itself and an immediately following newline.
<lang ML/I>MCSKIP " WITH " NL
<syntaxhighlight lang="ml/i">MCSKIP " WITH " NL
Goodbye, World!""</lang>
Goodbye, World!""</syntaxhighlight>


=={{header|Modula-2}}==
=={{header|Modula-2}}==
<lang modula2>MODULE HelloWorld;
<syntaxhighlight lang="modula2">MODULE HelloWorld;
FROM Terminal IMPORT WriteString,ReadChar;
FROM Terminal IMPORT WriteString,ReadChar;


Line 814: Line 978:
WriteString("Goodbye, World!");
WriteString("Goodbye, World!");
ReadChar
ReadChar
END HelloWorld.</lang>
END HelloWorld.</syntaxhighlight>


=={{header|N/t/roff}}==
=={{header|N/t/roff}}==
Line 822: Line 986:
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.
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.


<lang N/t/roff>
<syntaxhighlight lang="n/t/roff">
Goodbye, World!
Goodbye, World!
</syntaxhighlight>
</lang>


=={{header|Nanoquery}}==
=={{header|Nanoquery}}==
<lang nanoquery>print "Goodbye, world!"</lang>
<syntaxhighlight lang="nanoquery">print "Goodbye, world!"</syntaxhighlight>


=={{header|Neko}}==
=={{header|Neko}}==
The Neko builtin $print does not add a newline.
The Neko builtin $print does not add a newline.


<syntaxhighlight lang="actionscript">/**
<lang ActionScript>/**
hellonnl.neko
hellonnl.neko
Tectonics:
Tectonics:
Line 845: Line 1,009:
*/
*/


$print("Goodbye, World!");</lang>
$print("Goodbye, World!");</syntaxhighlight>


{{out}}
{{out}}
Line 854: Line 1,018:
=={{header|Nemerle}}==
=={{header|Nemerle}}==


<lang Nemerle>using System.Console;
<syntaxhighlight lang="nemerle">using System.Console;


module Hello
module Hello
Line 864: Line 1,028:
Write("Goodbye, ");
Write("Goodbye, ");
Write("world!");
Write("world!");
}</lang>
}</syntaxhighlight>


=={{header|NetRexx}}==
=={{header|NetRexx}}==
<lang NetRexx>/* NetRexx */
<syntaxhighlight lang="netrexx">/* NetRexx */
options replace format comments java crossref symbols binary
options replace format comments java crossref symbols binary


say 'Goodbye, World!\-'
say 'Goodbye, World!\-'
</syntaxhighlight>
</lang>


=={{header|NewLISP}}==
=={{header|NewLISP}}==
<lang NewLISP>(print "Goodbye, World!")</lang>
<syntaxhighlight lang="newlisp">(print "Goodbye, World!")</syntaxhighlight>


=={{header|Nim}}==
=={{header|Nim}}==
<lang nim>stdout.write "Goodbye, World!"</lang>
<syntaxhighlight lang="nim">stdout.write "Goodbye, World!"</syntaxhighlight>


=={{header|NS-HUBASIC}}==
=={{header|NS-HUBASIC}}==
<lang NS-HUBASIC>10 PRINT "GOODBYE, WORLD!";</lang>
<syntaxhighlight lang="ns-hubasic">10 PRINT "GOODBYE, WORLD!";</syntaxhighlight>


=={{header|Oberon-2}}==
=={{header|Oberon-2}}==
<lang oberon2>
<syntaxhighlight lang="oberon2">
MODULE HelloWorld;
MODULE HelloWorld;
IMPORT Out;
IMPORT Out;
Line 889: Line 1,053:
Out.String("Goodbye, world!")
Out.String("Goodbye, world!")
END HelloWorld.
END HelloWorld.
</syntaxhighlight>
</lang>


=={{header|Objeck}}==
=={{header|Objeck}}==


<lang objeck>
<syntaxhighlight lang="objeck">
bundle Default {
bundle Default {
class SayGoodbye {
class SayGoodbye {
Line 901: Line 1,065:
}
}
}
}
</syntaxhighlight>
</lang>


=={{header|OCaml}}==
=={{header|OCaml}}==
Line 907: Line 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.
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.


<lang ocaml>print_string "Goodbye, World!"</lang>
<syntaxhighlight lang="ocaml">print_string "Goodbye, World!"</syntaxhighlight>


=={{header|Oforth}}==
=={{header|Oforth}}==
<lang Oforth>"Goodbye, World!" print</lang>
<syntaxhighlight lang="oforth">"Goodbye, World!" print</syntaxhighlight>


=={{header|Ol}}==
=={{header|Ol}}==
To omit the trailing newline use `display` instead of `print`.
To omit the trailing newline use `display` instead of `print`.
<lang scheme>
<syntaxhighlight lang="scheme">
(display "Goodbye, World!")
(display "Goodbye, World!")
</syntaxhighlight>
</lang>


=={{header|OOC}}==
=={{header|OOC}}==
To omit the trailing newline use print instead of println:
To omit the trailing newline use print instead of println:
<lang ooc>main: func {
<syntaxhighlight lang="ooc">main: func {
"Goodbye, World!" print()
"Goodbye, World!" print()
}</lang>
}</syntaxhighlight>


=={{header|Oxygene}}==
=={{header|Oxygene}}==
{{incorrect|Oxygene|output isn't consistent with the task's requirements: wording, capitalization.}}
{{incorrect|Oxygene|output isn't consistent with the task's requirements: wording, capitalization.}}


<lang oxygene>
<syntaxhighlight lang="oxygene">
namespace HelloWorld;
namespace HelloWorld;
Line 948: Line 1,112:
end.
end.
</syntaxhighlight>
</lang>
<pre>
<pre>
>HelloWorld.exe
>HelloWorld.exe
Line 955: Line 1,119:


=={{header|Panoramic}}==
=={{header|Panoramic}}==
<syntaxhighlight lang="panoramic">
<lang Panoramic>
rem insert a trailing semicolon.
rem insert a trailing semicolon.
print "Goodbye, World!";
print "Goodbye, World!";
print " Nice having known you."</lang>
print " Nice having known you."</syntaxhighlight>


=={{header|PARI/GP}}==
=={{header|PARI/GP}}==
<lang parigp>print1("Goodbye, World!")</lang>
<syntaxhighlight lang="parigp">print1("Goodbye, World!")</syntaxhighlight>


=={{header|Pascal}}==
=={{header|Pascal}}==
<lang pascal>program NewLineOmission(output);
<syntaxhighlight lang="pascal">program NewLineOmission(output);
begin
begin
write('Goodbye, World!');
write('Goodbye, World!');
end.</lang>
end.</syntaxhighlight>
Output:
Output:
<pre>% ./NewLineOmission
<pre>% ./NewLineOmission
Line 975: Line 1,139:
=={{header|PASM}}==
=={{header|PASM}}==


<lang pasm>print "Goodbye World!" # Newlines do not occur unless we embed them
<syntaxhighlight lang="pasm">print "Goodbye World!" # Newlines do not occur unless we embed them
end</lang>
end</syntaxhighlight>


=={{header|Perl}}==
=={{header|Perl}}==
<lang perl>print "Goodbye, World!"; # A newline does not occur automatically</lang>
<syntaxhighlight lang="perl">print "Goodbye, World!"; # A newline does not occur automatically</syntaxhighlight>


=={{header|Phix}}==
=={{header|Phix}}==
Phix does not add '\n' automatically, except for the '?' (debugging) shorthand; if you want one you must remember to add it explicitly.
Phix does not add '\n' automatically, except for the '?' (debugging) shorthand; if you want one you must remember to add it explicitly.
<!--<lang Phix>-->
<!--<syntaxhighlight lang="phix">-->
<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>
<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>
<!--</lang>-->
<!--</syntaxhighlight>-->


=={{header|PHL}}==
=={{header|PHL}}==
Printf doesn't add newline automatically.
Printf doesn't add newline automatically.


<lang phl>module helloworld_noln;
<syntaxhighlight lang="phl">module helloworld_noln;
extern printf;
extern printf;


Line 996: Line 1,160:
printf("Goodbye, World!");
printf("Goodbye, World!");
return 0;
return 0;
]</lang>
]</syntaxhighlight>


=={{header|PHP}}==
=={{header|PHP}}==


<lang PHP>echo "Goodbye, World !";</lang>
<syntaxhighlight lang="php">echo "Goodbye, World !";</syntaxhighlight>

=={{header|Picat}}==
<syntaxhighlight lang="picat">print("Goodbye, World!")</syntaxhighlight>


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==
<lang PicoLisp>(prin "Goodbye, World!")</lang>
<syntaxhighlight lang="picolisp">(prin "Goodbye, World!")</syntaxhighlight>


=={{header|Pict}}==
=={{header|Pict}}==
<lang pict>(pr "Hello World!");</lang>
<syntaxhighlight lang="pict">(pr "Hello World!");</syntaxhighlight>


=={{header|Pike}}==
=={{header|Pike}}==
<lang Pike>write("Goodbye, World!");</lang>
<syntaxhighlight lang="pike">write("Goodbye, World!");</syntaxhighlight>


=={{header|Pixilang}}==
=={{header|Pixilang}}==
<lang Pixilang>fputs("Goodbye, World!")</lang>
<syntaxhighlight lang="pixilang">fputs("Goodbye, World!")</syntaxhighlight>


=={{header|PL/I}}==
=={{header|PL/I}}==
<syntaxhighlight lang="pl/i">
<lang PL/I>
put ('Goodbye, World!');
put ('Goodbye, World!');
</syntaxhighlight>
</lang>


=={{header|Plain English}}==
=={{header|Plain English}}==
<lang plainenglish>To run:
<syntaxhighlight lang="plainenglish">To run:
Start up.
Start up.
Write "Goodbye, world!" on the console without advancing.
Write "Goodbye, world!" on the console without advancing.
Wait for the escape key.
Wait for the escape key.
Shut down.</lang>
Shut down.</syntaxhighlight>


=={{header|PowerShell}}==
=={{header|PowerShell}}==
<lang PowerShell>Write-Host -NoNewLine "Goodbye, "
<syntaxhighlight lang="powershell">Write-Host -NoNewLine "Goodbye, "
Write-Host -NoNewLine "World!"</lang>
Write-Host -NoNewLine "World!"</syntaxhighlight>
{{Out}}
{{Out}}
<pre>Goodbye, World!PS C:\></pre>
<pre>Goodbye, World!PS C:\></pre>


=={{header|Processing}}==
=={{header|Processing}}==
<lang processing>
<syntaxhighlight lang="processing">
print("Goodbye, World!"); /* No automatic newline */
print("Goodbye, World!"); /* No automatic newline */
</syntaxhighlight>
</lang>


=={{header|PureBasic}}==
=={{header|PureBasic}}==
<lang PureBasic>OpenConsole()
<syntaxhighlight lang="purebasic">OpenConsole()
Print("Goodbye, World!")
Print("Goodbye, World!")
Input() ;wait for enter key to be pressed</lang>
Input() ;wait for enter key to be pressed</syntaxhighlight>


=={{header|Python}}==
=={{header|Python}}==
<lang python>import sys
<syntaxhighlight lang="python">import sys
sys.stdout.write("Goodbye, World!")</lang>
sys.stdout.write("Goodbye, World!")</syntaxhighlight>


{{works with|Python|3.x}}
{{works with|Python|3.x}}
<lang python>print("Goodbye, World!", end="")</lang>
<syntaxhighlight lang="python">print("Goodbye, World!", end="")</syntaxhighlight>


=={{header|Quackery}}==
=={{header|Quackery}}==
Line 1,053: Line 1,220:
Quackery does not automatically insert a new line.
Quackery does not automatically insert a new line.


<lang Quackery>say "Goodbye, world!"</lang>
<syntaxhighlight lang="quackery">say "Goodbye, world!"</syntaxhighlight>


=={{header|R}}==
=={{header|R}}==
<lang R>cat("Goodbye, world!")</lang>
<syntaxhighlight lang="r">cat("Goodbye, world!")</syntaxhighlight>


=={{header|Ra}}==
=={{header|Ra}}==
<syntaxhighlight lang="ra">
<lang Ra>
class HelloWorld
class HelloWorld
**Prints "Goodbye, World!" without a new line**
**Prints "Goodbye, World!" without a new line**
Line 1,066: Line 1,233:


print "Goodbye, World!" without new line
print "Goodbye, World!" without new line
</syntaxhighlight>
</lang>


=={{header|Racket}}==
=={{header|Racket}}==
<lang Racket>#lang racket
<syntaxhighlight lang="racket">#lang racket
(display "Goodbye, World!")</lang>
(display "Goodbye, World!")</syntaxhighlight>


=={{header|Raku}}==
=={{header|Raku}}==
(formerly Perl 6)
(formerly Perl 6)
A newline is not added automatically to print or printf
A newline is not added automatically to print or printf
<lang perl6>print "Goodbye, World!";
<syntaxhighlight lang="raku" line>print "Goodbye, World!";
printf "%s", "Goodbye, World!";</lang>
printf "%s", "Goodbye, World!";</syntaxhighlight>


=={{header|RASEL}}==
=={{header|RASEL}}==
<lang>"!dlroW ,olleH">:?@,Gj</lang>
<syntaxhighlight lang="text">"!dlroW ,olleH">:?@,Gj</syntaxhighlight>


=={{header|REBOL}}==
=={{header|REBOL}}==
<lang REBOL>prin "Goodbye, World!"</lang>
<syntaxhighlight lang="rebol">prin "Goodbye, World!"</syntaxhighlight>


=={{header|Red}}==
=={{header|Red}}==
<lang Red>prin "Goodbye, World!"</lang>
<syntaxhighlight lang="red">prin "Goodbye, World!"</syntaxhighlight>


=={{header|Retro}}==
=={{header|Retro}}==
<lang Retro>'Goodbye,_World! s:put</lang>
<syntaxhighlight lang="retro">'Goodbye,_World! s:put</syntaxhighlight>


=={{header|REXX}}==
=={{header|REXX}}==
Line 1,094: Line 1,261:
<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>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.
<br>(lines) from a calling program(s), or the operating system (shell) which is usually some sort of a "prompt" text string.
<lang rexx>/*REXX pgm displays a "Goodbye, World!" without a trailing newline. */
<syntaxhighlight lang="rexx">/*REXX pgm displays a "Goodbye, World!" without a trailing newline. */


call charout ,'Goodbye, World!'</lang>
call charout ,'Goodbye, World!'</syntaxhighlight>


=={{header|Ring}}==
=={{header|Ring}}==
<lang ring>see "Goodbye, World!"</lang>
<syntaxhighlight lang="ring">see "Goodbye, World!"</syntaxhighlight>


=={{header|Ruby}}==
=={{header|Ruby}}==
<lang ruby>print "Goodbye, World!"</lang>
<syntaxhighlight lang="ruby">print "Goodbye, World!"</syntaxhighlight>


=={{header|Run BASIC}}==
=={{header|Run BASIC}}==
<lang RunBasic>print "Goodbye, World!";</lang>
<syntaxhighlight lang="runbasic">print "Goodbye, World!";</syntaxhighlight>


=={{header|Rust}}==
=={{header|Rust}}==
<lang rust>fn main () {
<syntaxhighlight lang="rust">fn main () {
print!("Goodbye, World!");
print!("Goodbye, World!");
}</lang>
}</syntaxhighlight>


=={{header|Salmon}}==
=={{header|Salmon}}==
<lang Salmon>print("Goodbye, World!");</lang>
<syntaxhighlight lang="salmon">print("Goodbye, World!");</syntaxhighlight>


=={{header|Scala}}==
=={{header|Scala}}==
Line 1,119: Line 1,286:
===Ad hoc REPL solution===
===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:
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:
<lang Scala>print("Goodbye, World!")</lang>
<syntaxhighlight lang="scala">print("Goodbye, World!")</syntaxhighlight>


=={{header|Scheme}}==
=={{header|Scheme}}==
<lang scheme>(display "Goodbye, World!")</lang>
<syntaxhighlight lang="scheme">(display "Goodbye, World!")</syntaxhighlight>


=={{header|Scilab}}==
=={{header|Scilab}}==
Scilab can emulate C <code>printf</code> which, by default, does not return the carriage.
Scilab can emulate C <code>printf</code> which, by default, does not return the carriage.
<lang scilab>print("Goodbye, World!")</lang>
<syntaxhighlight lang="scilab">print("Goodbye, World!")</syntaxhighlight>


=={{header|Seed7}}==
=={{header|Seed7}}==
<lang seed7>$ include "seed7_05.s7i";
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i";
const proc: main is func
const proc: main is func
begin
begin
write("Goodbye, World!");
write("Goodbye, World!");
end func;</lang>
end func;</syntaxhighlight>


=={{header|SETL}}==
=={{header|SETL}}==
<lang setl>nprint( 'Goodbye, World!' );</lang>
<syntaxhighlight lang="setl">nprint( 'Goodbye, World!' );</syntaxhighlight>


=={{header|Sidef}}==
=={{header|Sidef}}==
<lang ruby>print "Goodbye, World!";</lang>
<syntaxhighlight lang="ruby">print "Goodbye, World!";</syntaxhighlight>
or:
or:
<lang ruby>"%s".printf("Goodbye, World!");</lang>
<syntaxhighlight lang="ruby">"%s".printf("Goodbye, World!");</syntaxhighlight>


=={{header|Smalltalk}}==
=={{header|Smalltalk}}==
<lang smalltalk>
<syntaxhighlight lang="smalltalk">
Transcript show: 'Goodbye, World!'.
Transcript show: 'Goodbye, World!'.
</syntaxhighlight>
</lang>


=={{header|Standard ML}}==
=={{header|Standard ML}}==
<lang sml>print "Goodbye, World!"</lang>
<syntaxhighlight lang="sml">print "Goodbye, World!"</syntaxhighlight>


=={{header|Swift}}==
=={{header|Swift}}==
{{works with|Swift|2.x+}}
{{works with|Swift|2.x+}}
<lang swift>print("Goodbye, World!", terminator: "")</lang>
<syntaxhighlight lang="swift">print("Goodbye, World!", terminator: "")</syntaxhighlight>
{{works with|Swift|1.x}}
{{works with|Swift|1.x}}
<lang swift>print("Goodbye, World!")</lang>
<syntaxhighlight lang="swift">print("Goodbye, World!")</syntaxhighlight>


=={{header|Tcl}}==
=={{header|Tcl}}==
<lang tcl>puts -nonewline "Goodbye, World!"</lang>
<syntaxhighlight lang="tcl">puts -nonewline "Goodbye, World!"</syntaxhighlight>


=={{header|Transact-SQL}}==
=={{header|Transact-SQL}}==
{{incorrect|Transact-SQL|output isn't consistent with the task's requirements: wrong word.}}
{{incorrect|Transact-SQL|output isn't consistent with the task's requirements: wrong word.}}
As an output statement, PRINT always adds a new line
As an output statement, PRINT always adds a new line
<lang Transact-SQL> PRINT 'Goodbye, World!'</lang>
<syntaxhighlight lang="transact-sql"> PRINT 'Goodbye, World!'</syntaxhighlight>
or:
or:
As a result set
As a result set
<lang Transact-SQL> select 'Goodbye, World!'</lang>
<syntaxhighlight lang="transact-sql"> select 'Goodbye, World!'</syntaxhighlight>


=={{header|TUSCRIPT}}==
=={{header|TUSCRIPT}}==
<lang tuscript>
<syntaxhighlight lang="tuscript">
$$ MODE TUSCRIPT
$$ MODE TUSCRIPT
PRINT "Goodbye, World!"
PRINT "Goodbye, World!"
</syntaxhighlight>
</lang>
Output:
Output:
<pre>
<pre>
Line 1,181: Line 1,348:
=={{header|TXR}}==
=={{header|TXR}}==
Possible using access to standard output stream via TXR Lisp:
Possible using access to standard output stream via TXR Lisp:
<lang bash>$ txr -e '(put-string "Goodbye, world!")'
<syntaxhighlight lang="bash">$ txr -e '(put-string "Goodbye, world!")'
Goodbye, world!$</lang>
Goodbye, world!$</syntaxhighlight>


=={{header|UNIX Shell}}==
=={{header|UNIX Shell}}==
Line 1,189: Line 1,356:
{{works with|Bourne Shell}}
{{works with|Bourne Shell}}


<lang bash>printf "Goodbye, World!" # This works. There is no newline.
<syntaxhighlight lang="bash">printf "Goodbye, World!" # This works. There is no newline.
printf %s "-hyphens and % signs" # Use %s with arbitrary strings.</lang>
printf %s "-hyphens and % signs" # Use %s with arbitrary strings.</syntaxhighlight>


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


<lang bash>echo -n 'Goodbye, World!'</lang>
<syntaxhighlight lang="bash">echo -n 'Goodbye, World!'</syntaxhighlight>
or
or
<lang bash>echo 'Goodbye, World!\c'</lang>
<syntaxhighlight lang="bash">echo 'Goodbye, World!\c'</syntaxhighlight>


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.)
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 1,204: Line 1,371:
{{works with|zsh}}
{{works with|zsh}}


<lang bash>print -n "Goodbye, World!"
<syntaxhighlight lang="bash">print -n "Goodbye, World!"
print -nr -- "-hyphens and \backslashes"</lang>
print -nr -- "-hyphens and \backslashes"</syntaxhighlight>


==={{header|C Shell}}===
==={{header|C Shell}}===
C Shell does support <code>echo -n</code> and omits the newline.
C Shell does support <code>echo -n</code> and omits the newline.


<lang csh>echo -n "Goodbye, World!"
<syntaxhighlight lang="csh">echo -n "Goodbye, World!"
echo -n "-hyphens and \backslashes"</lang>
echo -n "-hyphens and \backslashes"</syntaxhighlight>


=={{header|Ursa}}==
=={{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.
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.
<lang ursa>out "goodbye world!" console</lang>
<syntaxhighlight lang="ursa">out "goodbye world!" console</syntaxhighlight>


=={{header|Verbexx}}==
=={{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
<lang verbexx>@STDOUT "Goodbye, World!";</lang>
|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}}==
=={{header|Verilog}}==
<lang Verilog>module main;
<syntaxhighlight lang="verilog">module main;
initial
initial
begin
begin
Line 1,228: Line 1,419:
$finish ;
$finish ;
end
end
endmodule</lang>
endmodule</syntaxhighlight>




=={{header|Vim Script}}==
=={{header|Vim Script}}==
<lang vim>echon "Goodbye, World!"</lang>
<syntaxhighlight lang="vim">echon "Goodbye, World!"</syntaxhighlight>


=={{header|Visual Basic .NET}}==
=={{header|Visual Basic .NET}}==
<lang vbnet>Module Module1
<syntaxhighlight lang="vbnet">Module Module1


Sub Main()
Sub Main()
Line 1,241: Line 1,432:
End Sub
End Sub


End Module</lang>
End Module</syntaxhighlight>

=={{header|V (Vlang)}}==
<syntaxhighlight lang="v (vlang)">fn main() { print("Goodbye, World!") }</syntaxhighlight>


=={{header|Web 68}}==
=={{header|Web 68}}==
Line 1,247: Line 1,441:
Use the command 'tang -V hello.w68', then 'chmod +x hello.a68', then './hello.a68'
Use the command 'tang -V hello.w68', then 'chmod +x hello.a68', then './hello.a68'


<lang web68>@ @a@=#!/usr/bin/a68g -nowarn@>@\BEGIN print("Hello World") END</lang>
<syntaxhighlight lang="web68">@ @a@=#!/usr/bin/a68g -nowarn@>@\BEGIN print("Hello World") END</syntaxhighlight>


=={{header|Wren}}==
=={{header|Wren}}==
<lang ecmascript>System.write("Goodbye, World!")</lang>
<syntaxhighlight lang="wren">System.write("Goodbye, World!")</syntaxhighlight>


=={{header|XLISP}}==
=={{header|XLISP}}==
Either
Either
<lang scheme>(display "Goodbye, World!")</lang>
<syntaxhighlight lang="scheme">(display "Goodbye, World!")</syntaxhighlight>
or
or
<lang lisp>(princ "Goodbye, World!")</lang>
<syntaxhighlight lang="lisp">(princ "Goodbye, World!")</syntaxhighlight>


=={{header|XPath}}==
<syntaxhighlight lang="xpath">'Goodbye, World!'</syntaxhighlight>


=={{header|XPL0}}==
=={{header|XPL0}}==
<lang XPL0>code Text=12;
<syntaxhighlight lang="xpl0">code Text=12;
Text(0, "Goodbye, World!")</lang>
Text(0, "Goodbye, World!")</syntaxhighlight>

=={{header|XSLT}}==
<syntaxhighlight lang="text"><xsl:text>Goodbye, World!</xsl:text></syntaxhighlight>


=={{header|zkl}}==
=={{header|zkl}}==
<lang zkl>print("Goodbye, World!");
<syntaxhighlight lang="zkl">print("Goodbye, World!");
Console.write("Goodbye, World!");</lang>
Console.write("Goodbye, World!");</syntaxhighlight>


=={{header|Zig}}==
=={{header|Zig}}==
<syntaxhighlight lang="zig">const std = @import("std");
{{works with|Zig|0.7.0 and higher}}
<lang Zig>
const std = @import("std");


// return type is Error Union type.
// it will return an inferred error set or void data type:
pub fn main() !void {
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try std.io.getStdOut().writer().writeAll("Hello world!");
}</syntaxhighlight>
try stdout.print("Goodbye, {s}", .{"World!"}); // anonymous struct literal used for string substitution
}
</lang>


=={{header|ZX Spectrum Basic}}==
=={{header|ZX Spectrum Basic}}==
<lang basic>10 REM The trailing semicolon prevents a newline
<syntaxhighlight lang="basic">10 REM The trailing semicolon prevents a newline
20 PRINT "Goodbye, World!";</lang>
20 PRINT "Goodbye, World!";</syntaxhighlight>


{{omit from|Craft Basic|No keyword to output without newline}}
{{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}}
{{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}}

Latest revision as of 17:48, 1 March 2024

Task
Hello world/Newline omission
You are encouraged to solve this task according to the task description, using any language you may know.

Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.


Task

Display the string   Goodbye, World!   without a trailing newline.


Related tasks



11l

print(‘Goodbye, World!’, end' ‘’)

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 A0 as its argument (e.g. LEA myString,A0 JSR PrintString). The hardware-specific PrintChar routine is left unimplemented.

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

ACL2

(cw "Goodbye, World!")

Action!

PROC Main()
  Print("Goodbye, World!")
RETURN
Output:

Screenshot from Atari 8-bit computer

Goodbye, World!

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 stdout on UNIX systems.

with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;

Using Ada.Text_IO.Text_Streams instead allows us to control the termination.

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;

Agena

io.write( "Goodbye, World!" )

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.

BEGIN
   print ("Goodbye, World!")
END

Arturo

prints "Goodbye, World!"
Output:
Goodbye, World!

ATS

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

AutoHotkey

DllCall("AllocConsole")
FileAppend, Goodbye`, World!, CONOUT$ ; No newline outputted
MsgBox

AutoIt

ConsoleWrite("Goodbye, World!")

AWK

BEGIN { printf("Goodbye, World!") }

Axe

Disp "Goodbye, World!"

B

Works with: The Amsterdam Compiler Kit - B version V6.1pre1
main()
{
    putstr("Goodbye, World!");
    return(0);
}

BASIC

10 REM The trailing semicolon prevents a newline
20 PRINT "Goodbye, World!";

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

PRINT "Goodbye, World!";
PRINT "Goodbye, World!" FORMAT "%s"

Applesoft BASIC

PRINT "GOODBYE, WORLD!";

Chipmunk Basic

Works with: Chipmunk Basic version 3.6.4
print "Goodbye, World!";  '' the trailing semi-colon suppresses the new line

Commodore 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
Output:
Goodbye, World!(End of the world)

ready.

BASIC256

Output all on a single line.

print "Goodbye,";
print " ";
print "World!";

GW-BASIC

Works with: BASICA
10 PRINT "Goodbye, World!";  '' the trailing semi-colon suppresses the new line

IS-BASIC

10 PRINT "Goodbye, World! ";

Minimal BASIC

10 PRINT "Goodbye, World!"; : REM the trailing semi-colon suppresses the new line
20 END

MSX Basic

10 PRINT "Goodbye, World!"; : REM the trailing semi-colon suppresses the new line

QBasic

Works with: FreeBASIC
Works with: True BASIC
Works with: Yabasic

A trailing semicolon prevents a newline

PRINT "Goodbye, World!";
END

Quite BASIC

10 PRINT "Goodbye, World!"; : REM the trailing semi-colon suppresses the new line

True BASIC

Works with: FreeBASIC
Works with: QBasic
Works with: Yabasic

A trailing semicolon prevents a newline

PRINT "Goodbye, World!";
END

XBasic

PROGRAM	"helloworld"
VERSION	"0.0000"

DECLARE FUNCTION  Entry ()

FUNCTION  Entry ()
    PRINT "Goodbye, World!";
END FUNCTION
END PROGRAM

Yabasic

Works with: FreeBASIC
Works with: QBasic
Works with: True BASIC

A trailing semicolon prevents a newline

print "Goodbye, World!"; 
end

Batch File

Under normal circumstances, when delayed expansion is disabled
The quoted form guarantees there are no hidden trailing spaces after World!

<nul set/p"=Goodbye, World!"
<nul set/p=Goodbye, World!

If delayed expansion is enabled, then the ! must be escaped
Escape once if quoted form, twice if unquoted.

setlocal enableDelayedExpansion
<nul set/p"=Goodbye, World^!"
<nul set/p=Goodbye, World^^^!

BBC BASIC

      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

bc

"Goodbye, World!"

beeswax

_`Goodbye, World!

beeswax prints everything without appending a newline character. beeswax has an instruction to explicitely print a newline character: N.

Befunge

In Befunge, a newline has to be explicitly output when required, so you can just not include one if it's not wanted.

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

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

*Goodbye, World!

Blade

print('Goodbye, World!')

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.

10 print "Goodbye, w";
20 print "orld!";

Bracmat

put$"Goodbye, World!"

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

>+++++[>++++>+>+>++++>>+++<<<+<+<++[>++>+++>+++>++++>+>+[<]>>-]<-]>>
+.>>+..<.--.++>>+.<<+.>>>-.>++.[<]++++[>++++<-]>.>>.+++.------.<-.[>]<+.[-]
[G   oo d  b     y   e    ,                     W  o   r      l  d     !]

C

In C, we do not get a newline unless we embed one:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
  (void) printf("Goodbye, World!");    /* No automatic newline */
  return EXIT_SUCCESS;
}

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.

C#

using System;

class Program
{
    static void Main(string[] args)
    {
        //Using Console.WriteLine() will append a newline
        Console.WriteLine("Goodbye, World!");

        //Using Console.Write() will not append a newline
        Console.Write("Goodbye, World!");
    }
}

C++

#include <iostream>

int main() {
  std::cout << "Goodbye, World!";
  return 0;
}

Clipper

?? "Goodbye, World!"

Clojure

(print "Goodbye, World!")

COBOL

       IDENTIFICATION DIVISION.
       PROGRAM-ID. GOODBYE-WORLD.
       PROCEDURE DIVISION.
           DISPLAY 'Goodbye, World!' WITH NO ADVANCING.
           STOP RUN.
       END PROGRAM GOODBYE-WORLD.

CoffeeScript

Node JS:

process.stdout.write "Goodbye, World!"

Common Lisp

(princ "Goodbye, World!")

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

D

Works with: D version 2.0
import std.stdio;

void main() {
    write("Goodbye, World!");
}

Dart

import 'dart:io';
 
void main() {
  stdout.write("Goodbye, World!");
}

Dc

[Goodbye, World!]P
370913249815566165486152944077005857 P

Delphi

program Project1;

{$APPTYPE CONSOLE}

begin
  Write('Goodbye, World!');
end.

dt

"Goodbye, World!" p

DWScript

Print('Goodbye, World!');

Dyalect

print("Goodbye, World!", terminator: "")

Dylan.NET

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

One Line version:

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

Goodbye World Program:

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

Déjà Vu

!print\ "Goodbye, World!"

EasyLang

# write omits newline
write "Goodbye, World!"

EchoLisp

(begin 
    (write "GoodBye, World")
    (write "Next on same line"))

Elena

ELENA 4.x:

public program()
{
    //print will not append a newline
    console.write("Goodbye, World!")
}

Elixir

IO.write "Goodbye, World!"

Emacs Lisp

(princ "Goodbye, World!")
Output:
Goodbye, World!

EMal

write("Goodbye, World!")

Erlang

In erlang a newline must be specified in the format string.

io:format("Goodbye, world!").

ERRE

.......
PRINT("Goodbye, World!";)
.......

Euphoria

-- In Euphoria puts() does not insert a newline character after outputting a string
puts(1,"Goodbye, world!")

F#

// A program that will run in the interpreter (fsi.exe)
printf "Goodbye, World!";;

// A compiled program
[<EntryPoint>]
let main args =
    printf "Goodbye, World!"
    0

Factor

USE: io
"Goodbye, World!" write

Falcon

With the print() function:

print("Goodbye, World!")

Or via "fast print":

>> "Goodbye, World!"

Fantom

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

}

FOCAL

FOCAL does not insert a newline unless we specifically request one.

TYPE "Goodbye, World!"

Forth

\ The Forth word ." does not insert a newline character after outputting a string
." Goodbye, World!"

Fortran

program bye
  write (*,'(a)',advance='no') 'Goodbye, World!'
end program bye

The "advance" facility was introduced with F90, as was the ability to specify format instructions (the '(A)' part) without a separate FORMAT statement. Earlier, there was a common extension:

      WRITE (6,1) "Goodbye, World!"
    1 FORMAT (A,$)
      END

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.

FreeBASIC

' FB 1.10.1 Win64

Print "Goodbye, World!";  ' the trailing semi-colon suppresses the new line
Sleep

Frink

print["Goodbye, World!"]


FutureBasic

FB has several ways to suppress line feeds and/or carriage returns. A few are demonstrated here.

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

Gambas

Click this link to run this code

Public Sub Main()

Print "Goodbye, "; 'The semicolon stops the newline being added
Print "World!"

End

Output:

Goodbye, World!

gecho

'Hello, <> 'World! print

Genie

[indent=4]
/*
  Hello, with no newline, in Genie
  valac helloNoNewline.gs
*/

init
    stdout.printf("%s", "Goodbye, World!")
Output:
prompt$ valac helloNoNewline.gs
prompt$ ./helloNoNewline
Goodbye, World!prompt$

GML

show_message("Goodbye, World!")

Go

package main

import "fmt"

func main() { fmt.Print("Goodbye, World!") }

Groovy

print "Goodbye, world"

GUISS

In Graphical User Interface Support Script, we specify a newline, if we want one. The following will not produce a newline:

Start,Programs,Accessories,Notepad,Type:Goodbye World[pling]

Harbour

?? "Goodbye, world"
or
QQout( "Goodbye, world" )

Haskell

main = putStr "Goodbye, world"

HolyC

"Goodbye, World!";

Io

write("Goodbye, World!")

Huginn

#! /bin/sh
exec huginn --no-argv -E "${0}" "${@}"
#! huginn

main() {
	print( "Goodbye, World!" );
	return ( 0 );
}

Icon and 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.

procedure main()
   writes("Goodbye, World!")    
end

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

J

With jconsole, stdout can be used.

   stdout
1!:2&4

1!:2&4 returns its input unmodified. To avoid implicit output (which would repeat the output), when used interactively:

   put=: 0 0 $ 1!:2&4

   put 'Goodbye, World!'
Goodbye, World!

However, J also works in graphical environments, which might not be connected to standard output. Solution:prompt from the misc package.

Example:

   load 'general/misc/prompt'
   prompt 'Goodbye, World!'
Goodbye, World!

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, prompt 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 text 1!:3 file 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.

Jack

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

Jakt

fn main() {
    print("Goodbye, World!")
}

Janet

(prin "Goodbye, World!")

Java

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

JavaScript

Node JS:

process.stdout.write("Goodbye, World!");

Joy

"Goodbye, World!" putchars.

jq

The "-j" command-line option suppresses the newline that would otherwise be printed, e.g. if "$" is the command-line prompt:

$ jq -n -j '"Goodbye, World!"'
Goodbye, World!$

The trailing "$" is the command-line prompt.

Similarly:

$ echo '"Goodbye, World!"' | jq -j 
Goodbye, World!$

Jsish

printf("Goodbye, World!")

Evaluated from the command line as:

Output:
prompt$ jsish -e 'printf("Goodbye, World!")'
Goodbye, World!prompt$

Julia

Julia provides a println function which appends a newline, and a print function which doesn't:

print("Goodbye, World!")

Kotlin

Translation of: Java
fun main(args: Array<String>) = print("Goodbye, World!")

Lang

fn.print(Goodbye, World!)

Lasso

Lasso provides a stdoutnl method that prints a trailing newline, and a stdout method that does not:

stdout("Goodbye, World!")

LFE

(io:format "Goodbye, World")

Liberty BASIC

A trailing semicolon prevents a newline

print "Goodbye, World!";

LIL

write Goodbye, World!

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

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
}

Logtalk

No action is necessary to avoid an unwanted newline.

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

Lua

io.write("Goodbye, World!")

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


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.

`Goodbye, World!'dnl

MANOOL

{{extern "manool.org.18/std/0.3/all"} in Out.Write["Goodbye, World!"]}

Maple

printf( "Goodbye, World!" );

Mathematica / Wolfram Language

NotebookWrite[EvaluationNotebook[], "Goodbye, World!"]

Another one that works in scripts:

WriteString[$Output, "Goodbye, World!"]

MATLAB / Octave

 fprintf('Goodbye, World!');

Microsoft Small Basic

TextWindow.Write("Goodbye, World!")
Output:
Goodbye, World!Press any key to continue...

min

"Goodbye, World!" print

mIRC Scripting Language

echo -ag Goodbye, World!

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

Goodbye, World!

More sophisticated solution

To make it clearer, we can define an ML/I skip to delete itself and an immediately following newline.

MCSKIP " WITH " NL
Goodbye, World!""

Modula-2

MODULE HelloWorld;
FROM Terminal IMPORT WriteString,ReadChar;

BEGIN
    WriteString("Goodbye, World!");
    ReadChar
END HelloWorld.

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 (.fi); 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.

Goodbye, World!

Nanoquery

print "Goodbye, world!"

Neko

The Neko builtin $print does not add a newline.

/**
 hellonnl.neko
 Tectonics:
   nekoc hellonnl.neko
   neko hellonnl

   -or-

   nekoc hellonnl.neko
   nekotools boot hellonnl.n
   ./hellonnl
*/

$print("Goodbye, World!");
Output:
prompt$ nekoc hellonnl.neko
prompt$ neko hellonnl
Goodbye, World!prompt$

Nemerle

using System.Console;

module Hello
{
    // as with C#, Write() does not append a newline
    Write("Goodbye, world!");

    // equivalently
    Write("Goodbye, ");
    Write("world!");
}

NetRexx

/* NetRexx */
options replace format comments java crossref symbols binary

say 'Goodbye, World!\-'

NewLISP

(print "Goodbye, World!")

Nim

stdout.write "Goodbye, World!"

NS-HUBASIC

10 PRINT "GOODBYE, WORLD!";

Oberon-2

MODULE HelloWorld;
IMPORT Out;
BEGIN
  Out.String("Goodbye, world!")
END HelloWorld.

Objeck

bundle Default {
  class SayGoodbye {
    function : Main(args : String[]) ~ Nil {
      "Goodbye, World!"->Print();
    }
  }
}

OCaml

In OCaml, the function print_endline prints a string followed by a newline character on the standard output and flush the standard output. And the function print_string just prints a string with nothing additional.

print_string "Goodbye, World!"

Oforth

"Goodbye, World!" print

Ol

To omit the trailing newline use `display` instead of `print`.

(display "Goodbye, World!")

OOC

To omit the trailing newline use print instead of println:

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

Oxygene

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

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

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.
>HelloWorld.exe
Farewell, cruel world!

Panoramic

rem insert a trailing semicolon.
print "Goodbye, World!";
print " Nice having known you."

PARI/GP

print1("Goodbye, World!")

Pascal

program NewLineOmission(output);
 
begin
  write('Goodbye, World!');
end.

Output:

% ./NewLineOmission 
Goodbye, World!% 

PASM

print "Goodbye World!"    # Newlines do not occur unless we embed them
end

Perl

print "Goodbye, World!";    # A newline does not occur automatically

Phix

Phix does not add '\n' automatically, except for the '?' (debugging) shorthand; if you want one you must remember to add it explicitly.

puts(1,"Goodbye, World!")

PHL

Printf doesn't add newline automatically.

module helloworld_noln;
extern printf;

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

PHP

echo "Goodbye, World !";

Picat

print("Goodbye, World!")

PicoLisp

(prin "Goodbye, World!")

Pict

(pr "Hello World!");

Pike

write("Goodbye, World!");

Pixilang

fputs("Goodbye, World!")

PL/I

put ('Goodbye, World!');

Plain English

To run:
Start up.
Write "Goodbye, world!" on the console without advancing.
Wait for the escape key.
Shut down.

PowerShell

Write-Host -NoNewLine "Goodbye, "
Write-Host -NoNewLine "World!"
Output:
Goodbye, World!PS C:\>

Processing

print("Goodbye, World!");    /* No automatic newline */

PureBasic

OpenConsole()
Print("Goodbye, World!")
Input() ;wait for enter key to be pressed

Python

import sys
sys.stdout.write("Goodbye, World!")
Works with: Python version 3.x
print("Goodbye, World!", end="")

Quackery

Quackery does not automatically insert a new line.

say "Goodbye, world!"

R

cat("Goodbye, world!")

Ra

class HelloWorld
	**Prints "Goodbye, World!" without a new line**

	on start

		print "Goodbye, World!" without new line

Racket

#lang racket
(display "Goodbye, World!")

Raku

(formerly Perl 6) A newline is not added automatically to print or printf

print "Goodbye, World!";
printf "%s", "Goodbye, World!";

RASEL

"!dlroW ,olleH">:?@,Gj

REBOL

prin "Goodbye, World!"

Red

prin "Goodbye, World!"

Retro

'Goodbye,_World! s:put

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
blank line so as to not leave the state of the terminal with malformed "text lines" (which can be followed by other text
(lines) from a calling program(s), or the operating system (shell) which is usually some sort of a "prompt" text string.

/*REXX pgm displays a   "Goodbye, World!"   without a trailing newline. */

call charout ,'Goodbye, World!'

Ring

see "Goodbye, World!"

Ruby

print "Goodbye, World!"

Run BASIC

print "Goodbye, World!";

Rust

fn main () {
    print!("Goodbye, World!");
}

Salmon

print("Goodbye, World!");

Scala

Library: scala

Ad hoc REPL solution

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

print("Goodbye, World!")

Scheme

(display "Goodbye, World!")

Scilab

Scilab can emulate C printf which, by default, does not return the carriage.

print("Goodbye, World!")

Seed7

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

SETL

nprint( 'Goodbye, World!' );

Sidef

print "Goodbye, World!";

or:

"%s".printf("Goodbye, World!");

Smalltalk

Transcript show: 'Goodbye, World!'.

Standard ML

print "Goodbye, World!"

Swift

Works with: Swift version 2.x+
print("Goodbye, World!", terminator: "")
Works with: Swift version 1.x
print("Goodbye, World!")

Tcl

puts -nonewline "Goodbye, World!"

Transact-SQL

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

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

As an output statement, PRINT always adds a new line

 PRINT 'Goodbye, World!'

or: As a result set

 select 'Goodbye, World!'

TUSCRIPT

$$ MODE TUSCRIPT
PRINT "Goodbye, World!"

Output:

Goodbye, World!

TXR

Possible using access to standard output stream via TXR Lisp:

$ txr -e '(put-string "Goodbye, world!")'
Goodbye, world!$

UNIX Shell

The echo command is not portable, and echo -n is not guaranteed to prevent a newline from occuring. With the original Bourne Shell, echo -n "Goodbye, World!" prints -n Goodbye, World! with a newline. So use a printf instead.

Works with: Bourne Shell
printf "Goodbye, World!"          # This works. There is no newline.
printf %s "-hyphens and % signs"  # Use %s with arbitrary strings.

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:

echo -n 'Goodbye, World!'

or

echo 'Goodbye, World!\c'

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

Works with: ksh93
Works with: pdksh
Works with: zsh
print -n "Goodbye, World!"
print -nr -- "-hyphens and \backslashes"

C Shell

C Shell does support echo -n and omits the newline.

echo -n "Goodbye, World!"
echo -n "-hyphens and \backslashes"

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.

out "goodbye world!" console

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

Vale

Works with: Vale version 0.2.0
import stdlib.*;

exported func main() {
	print("Goodbye, World!");
}

Verbexx

@STDOUT "Goodbye, World!";

Verilog

module main;
  initial 
    begin
      $write("Goodbye, World!");
      $finish ;
    end
endmodule


Vim Script

echon "Goodbye, World!"

Visual Basic .NET

Module Module1

    Sub Main()
        Console.Write("Goodbye, World!")
    End Sub

End Module

V (Vlang)

fn main() { print("Goodbye, World!") }

Web 68

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

Details: 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'

@ @a@=#!/usr/bin/a68g -nowarn@>@\BEGIN print("Hello World") END

Wren

System.write("Goodbye, World!")

XLISP

Either

(display "Goodbye, World!")

or

(princ "Goodbye, World!")


XPath

'Goodbye, World!'

XPL0

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

XSLT

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

zkl

print("Goodbye, World!");
Console.write("Goodbye, World!");

Zig

const std = @import("std");

pub fn main() !void {
    try std.io.getStdOut().writer().writeAll("Hello world!");
}

ZX Spectrum Basic

10 REM The trailing semicolon prevents a newline
20 PRINT "Goodbye, World!";