Hello world/Newline omission: Difference between revisions
Content added Content deleted
(Blade) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 16: | Line 16: | ||
=={{header|11l}}== |
=={{header|11l}}== |
||
< |
<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. |
||
< |
<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</ |
EVEN</syntaxhighlight> |
||
=={{header|ACL2}}== |
=={{header|ACL2}}== |
||
< |
<syntaxhighlight lang="lisp">(cw "Goodbye, World!")</syntaxhighlight> |
||
=={{header|Action!}}== |
=={{header|Action!}}== |
||
< |
<syntaxhighlight lang="action!">PROC Main() |
||
Print("Goodbye, World!") |
Print("Goodbye, World!") |
||
RETURN</ |
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. |
||
< |
<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. |
||
< |
<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}}== |
||
< |
<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. |
||
< |
<syntaxhighlight lang="algol68">BEGIN |
||
print ("Goodbye, World!") |
print ("Goodbye, World!") |
||
END</ |
END</syntaxhighlight> |
||
=={{header|Arturo}}== |
=={{header|Arturo}}== |
||
< |
<syntaxhighlight lang="arturo">prints "Goodbye, World!"</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 93: | Line 93: | ||
=={{header|ATS}}== |
=={{header|ATS}}== |
||
< |
<syntaxhighlight lang="ats">implement main0 () = print "Goodbye, World!"</syntaxhighlight> |
||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
< |
<syntaxhighlight lang="ahk">DllCall("AllocConsole") |
||
FileAppend, Goodbye`, World!, CONOUT$ ; No newline outputted |
FileAppend, Goodbye`, World!, CONOUT$ ; No newline outputted |
||
MsgBox</ |
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}}== |
||
< |
<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}} |
||
< |
<syntaxhighlight lang="b">main() |
||
{ |
{ |
||
putstr("Goodbye, World!"); |
putstr("Goodbye, World!"); |
||
return(0); |
return(0); |
||
}</ |
}</syntaxhighlight> |
||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
< |
<syntaxhighlight lang="basic">10 REM The trailing semicolon prevents a newline |
||
20 PRINT "Goodbye, World!";</ |
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). |
||
< |
<syntaxhighlight lang="freebasic">PRINT "Goodbye, World!"; |
||
PRINT "Goodbye, World!" FORMAT "%s"</ |
PRINT "Goodbye, World!" FORMAT "%s"</syntaxhighlight> |
||
==={{header|Applesoft BASIC}}=== |
==={{header|Applesoft BASIC}}=== |
||
< |
<syntaxhighlight lang="applesoftbasic">PRINT "GOODBYE, WORLD!";</syntaxhighlight> |
||
==={{header|Commodore BASIC}}=== |
==={{header|Commodore BASIC}}=== |
||
< |
<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 140: | ||
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</ |
70 end</syntaxhighlight> |
||
'''Output:''' |
'''Output:''' |
||
<pre> |
<pre> |
||
Line 150: | Line 150: | ||
==={{header|BASIC256}}=== |
==={{header|BASIC256}}=== |
||
Output all on a single line. |
Output all on a single line. |
||
< |
<syntaxhighlight lang="basic256">print "Goodbye,"; |
||
print " "; |
print " "; |
||
print "World!";</ |
print "World!";</syntaxhighlight> |
||
==={{header|IS-BASIC}}=== |
==={{header|IS-BASIC}}=== |
||
< |
<syntaxhighlight lang="is-basic">10 PRINT "Goodbye, World! ";</syntaxhighlight> |
||
==={{header|QBasic}}=== |
==={{header|QBasic}}=== |
||
Line 162: | Line 162: | ||
{{works with|Yabasic}} |
{{works with|Yabasic}} |
||
A trailing semicolon prevents a newline |
A trailing semicolon prevents a newline |
||
< |
<syntaxhighlight lang="qbasic">PRINT "Goodbye, World!"; |
||
END</ |
END</syntaxhighlight> |
||
==={{header|True BASIC}}=== |
==={{header|True BASIC}}=== |
||
Line 170: | Line 170: | ||
{{works with|Yabasic}} |
{{works with|Yabasic}} |
||
A trailing semicolon prevents a newline |
A trailing semicolon prevents a newline |
||
< |
<syntaxhighlight lang="qbasic">PRINT "Goodbye, World!"; |
||
END</ |
END</syntaxhighlight> |
||
==={{header|Yabasic}}=== |
==={{header|Yabasic}}=== |
||
Line 178: | Line 178: | ||
{{works with|True BASIC}} |
{{works with|True BASIC}} |
||
A trailing semicolon prevents a newline |
A trailing semicolon prevents a newline |
||
< |
<syntaxhighlight lang="yabasic">print "Goodbye, World!"; |
||
end</ |
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! |
||
< |
<syntaxhighlight lang="dos"><nul set/p"=Goodbye, World!" |
||
<nul set/p=Goodbye, World!</ |
<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. |
||
< |
<syntaxhighlight lang="dos">setlocal enableDelayedExpansion |
||
<nul set/p"=Goodbye, World^!" |
<nul set/p"=Goodbye, World^!" |
||
<nul set/p=Goodbye, World^^^!</ |
<nul set/p=Goodbye, World^^^!</syntaxhighlight> |
||
=={{header|BBC BASIC}}== |
=={{header|BBC BASIC}}== |
||
< |
<syntaxhighlight lang="bbcbasic"> REM BBC BASIC accepts the standard trailing semicolon: |
||
PRINT "Goodbye World!"; |
PRINT "Goodbye World!"; |
||
Line 201: | Line 201: | ||
FOR i% = 1 TO LEN(GW$) |
FOR i% = 1 TO LEN(GW$) |
||
VDU ASCMID$(GW$, i%) |
VDU ASCMID$(GW$, i%) |
||
NEXT</ |
NEXT</syntaxhighlight> |
||
=={{header|Bc}}== |
=={{header|Bc}}== |
||
< |
<syntaxhighlight lang="bc">print "Goodbye, World!"</syntaxhighlight> |
||
=={{header|beeswax}}== |
=={{header|beeswax}}== |
||
<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 214: | ||
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. |
||
< |
<syntaxhighlight lang="befunge">"!dlroW ,eybdooG">:#,_@</syntaxhighlight> |
||
=={{header|Blade}}== |
=={{header|Blade}}== |
||
<lang |
<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. |
||
< |
<syntaxhighlight lang="bootbasic">10 print "Goodbye, w"; |
||
20 print "orld!";</ |
20 print "orld!";</syntaxhighlight> |
||
=={{header|Bracmat}}== |
=={{header|Bracmat}}== |
||
< |
<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***. |
||
< |
<syntaxhighlight lang="bf">>+++++[>++++>+>+>++++>>+++<<<+<+<++[>++>+++>+++>++++>+>+[<]>>-]<-]>> |
||
+.>>+..<.--.++>>+.<<+.>>>-.>++.[<]++++[>++++<-]>.>>.+++.------.<-.[>]<+.[-] |
+.>>+..<.--.++>>+.<<+.>>>-.>++.[<]++++[>++++<-]>.>>.+++.------.<-.[>]<+.[-] |
||
[G oo d b y e , W o r l d !]</ |
[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: |
||
< |
<syntaxhighlight lang="c">#include <stdio.h> |
||
#include <stdlib.h> |
#include <stdlib.h> |
||
Line 242: | Line 242: | ||
(void) printf("Goodbye, World!"); /* No automatic newline */ |
(void) printf("Goodbye, World!"); /* No automatic newline */ |
||
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
||
}</ |
}</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#}}== |
||
< |
<syntaxhighlight lang="csharp">using System; |
||
class Program |
class Program |
||
Line 259: | Line 259: | ||
Console.Write("Goodbye, World!"); |
Console.Write("Goodbye, World!"); |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
=={{header|C++}}== |
=={{header|C++}}== |
||
< |
<syntaxhighlight lang="cpp">#include <iostream> |
||
int main() { |
int main() { |
||
std::cout << "Goodbye, World!"; |
std::cout << "Goodbye, World!"; |
||
return 0; |
return 0; |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Clipper}}== |
=={{header|Clipper}}== |
||
< |
<syntaxhighlight lang="clipper">?? "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Clojure}}== |
=={{header|Clojure}}== |
||
< |
<syntaxhighlight lang="clojure">(print "Goodbye, World!")</syntaxhighlight> |
||
=={{header|COBOL}}== |
=={{header|COBOL}}== |
||
< |
<syntaxhighlight lang="cobol">IDENTIFICATION DIVISION. |
||
PROGRAM-ID. GOODBYE-WORLD. |
PROGRAM-ID. GOODBYE-WORLD. |
||
Line 284: | Line 284: | ||
END-DISPLAY |
END-DISPLAY |
||
. |
. |
||
STOP RUN.</ |
STOP RUN.</syntaxhighlight> |
||
=={{header|CoffeeScript}}== |
=={{header|CoffeeScript}}== |
||
Node JS: |
Node JS: |
||
< |
<syntaxhighlight lang="coffeescript">process.stdout.write "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |
||
< |
<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 340: | Line 340: | ||
'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}} |
||
< |
<syntaxhighlight lang="d">import std.stdio; |
||
void main() { |
void main() { |
||
write("Goodbye, World!"); |
write("Goodbye, World!"); |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Dc}}== |
=={{header|Dc}}== |
||
<lang |
<syntaxhighlight lang="dc">[Goodbye, World!]P</syntaxhighlight> |
||
<lang |
<syntaxhighlight lang="dc">370913249815566165486152944077005857 P</syntaxhighlight> |
||
=={{header|Delphi}}== |
=={{header|Delphi}}== |
||
< |
<syntaxhighlight lang="delphi">program Project1; |
||
{$APPTYPE CONSOLE} |
{$APPTYPE CONSOLE} |
||
Line 361: | Line 361: | ||
begin |
begin |
||
Write('Goodbye, World!'); |
Write('Goodbye, World!'); |
||
end.</ |
end.</syntaxhighlight> |
||
=={{header|DWScript}}== |
=={{header|DWScript}}== |
||
<lang |
<syntaxhighlight lang="delphi">Print('Goodbye, World!');</syntaxhighlight> |
||
=={{header|Dyalect}}== |
=={{header|Dyalect}}== |
||
< |
<syntaxhighlight lang="dyalect">print("Goodbye, World!", terminator: "")</syntaxhighlight> |
||
=={{header|Dylan.NET}}== |
=={{header|Dylan.NET}}== |
||
Line 377: | Line 377: | ||
{{works with|.NET|4.5}} |
{{works with|.NET|4.5}} |
||
One Line version: |
One Line version: |
||
< |
<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 396: | Line 396: | ||
end class |
end class |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Déjà Vu}}== |
=={{header|Déjà Vu}}== |
||
< |
<syntaxhighlight lang="dejavu">!print\ "Goodbye, World!"</syntaxhighlight> |
||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |
||
< |
<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: |
||
< |
<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!") |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Elixir}}== |
=={{header|Elixir}}== |
||
< |
<syntaxhighlight lang="elixir"> |
||
IO.write "Goodbye, World!" |
IO.write "Goodbye, World!" |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Emacs Lisp}}== |
=={{header|Emacs Lisp}}== |
||
< |
<syntaxhighlight lang="emacs lisp">(princ "Goodbye, World!")</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 430: | Line 430: | ||
=={{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. |
||
< |
<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}}== |
||
< |
<syntaxhighlight lang="euphoria">-- In Euphoria puts() does not insert a newline character after outputting a string |
||
puts(1,"Goodbye, world!")</ |
puts(1,"Goodbye, world!")</syntaxhighlight> |
||
=={{header|F Sharp|F#}}== |
=={{header|F Sharp|F#}}== |
||
< |
<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 453: | Line 453: | ||
printf "Goodbye, World!" |
printf "Goodbye, World!" |
||
0 |
0 |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
< |
<syntaxhighlight lang="factor">USE: io |
||
"Goodbye, World!" write</ |
"Goodbye, World!" write</syntaxhighlight> |
||
=={{header|Falcon}}== |
=={{header|Falcon}}== |
||
With the print() function: |
With the print() function: |
||
< |
<syntaxhighlight lang="falcon">print("Goodbye, World!")</syntaxhighlight> |
||
Or via "fast print": |
Or via "fast print": |
||
< |
<syntaxhighlight lang="falcon">>> "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Fantom}}== |
=={{header|Fantom}}== |
||
< |
<syntaxhighlight lang="fantom"> |
||
class Main { |
class Main { |
||
Void main() { |
Void main() { |
||
Line 473: | Line 473: | ||
} |
} |
||
} |
} |
||
</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. |
||
< |
<syntaxhighlight lang="focal">TYPE "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Forth}}== |
=={{header|Forth}}== |
||
< |
<syntaxhighlight lang="forth">\ The Forth word ." does not insert a newline character after outputting a string |
||
." Goodbye, World!"</ |
." Goodbye, World!"</syntaxhighlight> |
||
=={{header|Fortran}}== |
=={{header|Fortran}}== |
||
< |
<syntaxhighlight lang="fortran">program bye |
||
write (*,'(a)',advance='no') 'Goodbye, World!' |
write (*,'(a)',advance='no') 'Goodbye, World!' |
||
end program bye</ |
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: |
||
< |
<syntaxhighlight lang="fortran"> WRITE (6,1) "Goodbye, World!" |
||
1 FORMAT (A,$) |
1 FORMAT (A,$) |
||
END</ |
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 499: | Line 499: | ||
=={{header|FreeBASIC}}== |
=={{header|FreeBASIC}}== |
||
< |
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64 |
||
Print "Goodbye, World!"; '' the trailing semi-colon suppresses the new line |
Print "Goodbye, World!"; '' the trailing semi-colon suppresses the new line |
||
Sleep</ |
Sleep</syntaxhighlight> |
||
=={{header|Frink}}== |
=={{header|Frink}}== |
||
< |
<syntaxhighlight lang="frink">print["Goodbye, World!"]</syntaxhighlight> |
||
=={{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]''' |
||
< |
<syntaxhighlight lang="gambas">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</ |
End</syntaxhighlight> |
||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 521: | Line 521: | ||
=={{header|gecho}}== |
=={{header|gecho}}== |
||
< |
<syntaxhighlight lang="gecho">'Hello, <> 'World! print</syntaxhighlight> |
||
=={{header|Genie}}== |
=={{header|Genie}}== |
||
< |
<syntaxhighlight lang="genie">[indent=4] |
||
/* |
/* |
||
Hello, with no newline, in Genie |
Hello, with no newline, in Genie |
||
Line 531: | Line 531: | ||
init |
init |
||
stdout.printf("%s", "Goodbye, World!")</ |
stdout.printf("%s", "Goodbye, World!")</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 539: | Line 539: | ||
=={{header|GML}}== |
=={{header|GML}}== |
||
< |
<syntaxhighlight lang="lisp">show_message("Goodbye, World!")</syntaxhighlight> |
||
=={{header|Go}}== |
=={{header|Go}}== |
||
< |
<syntaxhighlight lang="go">package main |
||
import "fmt" |
import "fmt" |
||
func main() { fmt.Print("Goodbye, World!") }</ |
func main() { fmt.Print("Goodbye, World!") }</syntaxhighlight> |
||
=={{header|Groovy}}== |
=={{header|Groovy}}== |
||
< |
<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: |
||
< |
<syntaxhighlight lang="guiss">Start,Programs,Accessories,Notepad,Type:Goodbye World[pling]</syntaxhighlight> |
||
=={{header|Harbour}}== |
=={{header|Harbour}}== |
||
< |
<syntaxhighlight lang="visualfoxpro">?? "Goodbye, world" |
||
or |
or |
||
QQout( "Goodbye, world" ) |
QQout( "Goodbye, world" ) |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
< |
<syntaxhighlight lang="haskell">main = putStr "Goodbye, world"</syntaxhighlight> |
||
=={{header|HolyC}}== |
=={{header|HolyC}}== |
||
< |
<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}}== |
||
< |
<syntaxhighlight lang="huginn">#! /bin/sh |
||
exec huginn --no-argv -E "${0}" "${@}" |
exec huginn --no-argv -E "${0}" "${@}" |
||
#! huginn |
#! huginn |
||
Line 582: | Line 582: | ||
print( "Goodbye, World!" ); |
print( "Goodbye, World!" ); |
||
return ( 0 ); |
return ( 0 ); |
||
}</ |
}</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. |
||
< |
<syntaxhighlight lang="icon">procedure main() |
||
writes("Goodbye, World!") |
writes("Goodbye, World!") |
||
end</ |
end</syntaxhighlight> |
||
=={{header|IWBASIC}}== |
=={{header|IWBASIC}}== |
||
<syntaxhighlight lang="iwbasic"> |
|||
<lang IWBASIC> |
|||
'In a window |
'In a window |
||
Line 638: | Line 638: | ||
'Since this an IWBASIC console program. |
'Since this an IWBASIC console program. |
||
END |
END |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|J}}== |
=={{header|J}}== |
||
On a linux system, you can use 1!:3 because stdout is a file: |
On a linux system, you can use 1!:3 because stdout is a file: |
||
< |
<syntaxhighlight lang="j"> 'Goodbye, World!' 1!:3 <'/proc/self/fd/1' |
||
Goodbye, World! </ |
Goodbye, World! </syntaxhighlight> |
||
However, J works in environments other than Linux, so... |
However, J works in environments other than Linux, so... |
||
'''Solution''':<code>prompt</code> from the misc package. |
'''Solution''':<code>prompt</code> from the misc package. |
||
'''Example''':< |
'''Example''':<syntaxhighlight lang="j"> load 'general/misc/prompt' |
||
prompt 'Goodbye, World!' |
prompt 'Goodbye, World!' |
||
Goodbye, World!</ |
Goodbye, World!</syntaxhighlight> |
||
'''Notes''': J programs are normally run from a REPL, or session manager, which comes in several flavors. The traditional commandline-based terminal (jconsole), one of several desktop applications (jqt for the current version of J, jgtk and jwd for older 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 but still supported versions), a web-based frontend (jhs), and various mobile apps (J for iOS, Android). |
||
Line 660: | Line 660: | ||
=={{header|Jack}}== |
=={{header|Jack}}== |
||
< |
<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; |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Janet}}== |
=={{header|Janet}}== |
||
< |
<syntaxhighlight lang="janet">(prin "Goodbye, World!")</syntaxhighlight> |
||
=={{header|Java}}== |
=={{header|Java}}== |
||
< |
<syntaxhighlight lang="java">public class HelloWorld |
||
{ |
{ |
||
public static void main(String[] args) |
public static void main(String[] args) |
||
Line 677: | Line 677: | ||
System.out.print("Goodbye, World!"); |
System.out.print("Goodbye, World!"); |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
=={{header|JavaScript}}== |
=={{header|JavaScript}}== |
||
Node JS: |
Node JS: |
||
< |
<syntaxhighlight lang="javascript">process.stdout.write("Goodbye, World!");</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: |
||
< |
<syntaxhighlight lang="sh">$ jq -n -j '"Goodbye, World!"' |
||
Goodbye, World!$ </ |
Goodbye, World!$ </syntaxhighlight> |
||
The trailing "$" is the command-line prompt. |
The trailing "$" is the command-line prompt. |
||
Similarly: |
Similarly: |
||
< |
<syntaxhighlight lang="sh">$ echo '"Goodbye, World!"' | jq -j |
||
Goodbye, World!$ </ |
Goodbye, World!$ </syntaxhighlight> |
||
=={{header|Jsish}}== |
=={{header|Jsish}}== |
||
< |
<syntaxhighlight lang="javascript">printf("Goodbye, World!")</syntaxhighlight> |
||
Evaluated from the command line as: |
Evaluated from the command line as: |
||
Line 703: | Line 703: | ||
=={{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: |
||
< |
<syntaxhighlight lang="julia">print("Goodbye, World!")</syntaxhighlight> |
||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
{{trans|Java}} |
{{trans|Java}} |
||
< |
<syntaxhighlight lang="scala">fun main(args: Array<String>) = 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: |
||
< |
<syntaxhighlight lang="lasso">stdout("Goodbye, World!")</syntaxhighlight> |
||
=={{header|LFE}}== |
=={{header|LFE}}== |
||
< |
<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 |
||
< |
<syntaxhighlight lang="lb">print "Goodbye, World!"; |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|LIL}}== |
=={{header|LIL}}== |
||
<lang |
<syntaxhighlight lang="tcl">write Goodbye, World!</syntaxhighlight> |
||
=={{header|Limbo}}== |
=={{header|Limbo}}== |
||
< |
<syntaxhighlight lang="limbo">implement HelloWorld; |
||
include "sys.m"; sys: Sys; |
include "sys.m"; sys: Sys; |
||
Line 740: | Line 740: | ||
sys = load Sys Sys->PATH; |
sys = load Sys Sys->PATH; |
||
sys->print("Goodbye, World!"); # No automatic newline. |
sys->print("Goodbye, World!"); # No automatic newline. |
||
}</ |
}</syntaxhighlight> |
||
=={{header|LLVM}}== |
=={{header|LLVM}}== |
||
< |
<syntaxhighlight lang="llvm">; This is not strictly LLVM, as it uses the C library function "printf". |
||
; LLVM does not provide a way to print values, so the alternative would be |
; 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 756: | Line 756: | ||
%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 |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Logtalk}}== |
=={{header|Logtalk}}== |
||
No action is necessary to avoid an unwanted newline. |
No action is necessary to avoid an unwanted newline. |
||
< |
<syntaxhighlight lang="logtalk"> |
||
:- object(error_message). |
:- object(error_message). |
||
Line 768: | Line 768: | ||
:- end_object. |
:- end_object. |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Lua}}== |
=={{header|Lua}}== |
||
< |
<syntaxhighlight lang="lua">io.write("Goodbye, World!")</syntaxhighlight> |
||
=={{header|m4}}== |
=={{header|m4}}== |
||
Line 777: | Line 777: | ||
(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 |
<syntaxhighlight lang="m4">`Goodbye, World!'dnl</syntaxhighlight> |
||
=={{header|MANOOL}}== |
=={{header|MANOOL}}== |
||
< |
<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}}== |
||
< |
<syntaxhighlight lang="mathematica">NotebookWrite[EvaluationNotebook[], "Goodbye, World!"]</syntaxhighlight> |
||
Another one that works in scripts: |
Another one that works in scripts: |
||
< |
<syntaxhighlight lang="mathematica">WriteString[$Output, "Goodbye, World!"]</syntaxhighlight> |
||
=={{header|MATLAB}} / {{header|Octave}}== |
=={{header|MATLAB}} / {{header|Octave}}== |
||
< |
<syntaxhighlight lang="matlab"> fprintf('Goodbye, World!');</syntaxhighlight> |
||
=={{header|min}}== |
=={{header|min}}== |
||
< |
<syntaxhighlight lang="min">"Goodbye, World!" print</syntaxhighlight> |
||
=={{header|mIRC Scripting Language}}== |
=={{header|mIRC Scripting Language}}== |
||
<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 |
<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. |
||
< |
<syntaxhighlight lang="ml/i">MCSKIP " WITH " NL |
||
Goodbye, World!""</ |
Goodbye, World!""</syntaxhighlight> |
||
=={{header|Modula-2}}== |
=={{header|Modula-2}}== |
||
< |
<syntaxhighlight lang="modula2">MODULE HelloWorld; |
||
FROM Terminal IMPORT WriteString,ReadChar; |
FROM Terminal IMPORT WriteString,ReadChar; |
||
Line 817: | Line 817: | ||
WriteString("Goodbye, World!"); |
WriteString("Goodbye, World!"); |
||
ReadChar |
ReadChar |
||
END HelloWorld.</ |
END HelloWorld.</syntaxhighlight> |
||
=={{header|N/t/roff}}== |
=={{header|N/t/roff}}== |
||
Line 825: | Line 825: | ||
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. |
||
< |
<syntaxhighlight lang="n/t/roff"> |
||
Goodbye, World! |
Goodbye, World! |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Nanoquery}}== |
=={{header|Nanoquery}}== |
||
< |
<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 848: | Line 848: | ||
*/ |
*/ |
||
$print("Goodbye, World!");</ |
$print("Goodbye, World!");</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 857: | Line 857: | ||
=={{header|Nemerle}}== |
=={{header|Nemerle}}== |
||
< |
<syntaxhighlight lang="nemerle">using System.Console; |
||
module Hello |
module Hello |
||
Line 867: | Line 867: | ||
Write("Goodbye, "); |
Write("Goodbye, "); |
||
Write("world!"); |
Write("world!"); |
||
}</ |
}</syntaxhighlight> |
||
=={{header|NetRexx}}== |
=={{header|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}}== |
||
< |
<syntaxhighlight lang="newlisp">(print "Goodbye, World!")</syntaxhighlight> |
||
=={{header|Nim}}== |
=={{header|Nim}}== |
||
< |
<syntaxhighlight lang="nim">stdout.write "Goodbye, World!"</syntaxhighlight> |
||
=={{header|NS-HUBASIC}}== |
=={{header|NS-HUBASIC}}== |
||
< |
<syntaxhighlight lang="ns-hubasic">10 PRINT "GOODBYE, WORLD!";</syntaxhighlight> |
||
=={{header|Oberon-2}}== |
=={{header|Oberon-2}}== |
||
< |
<syntaxhighlight lang="oberon2"> |
||
MODULE HelloWorld; |
MODULE HelloWorld; |
||
IMPORT Out; |
IMPORT Out; |
||
Line 892: | Line 892: | ||
Out.String("Goodbye, world!") |
Out.String("Goodbye, world!") |
||
END HelloWorld. |
END HelloWorld. |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Objeck}}== |
=={{header|Objeck}}== |
||
< |
<syntaxhighlight lang="objeck"> |
||
bundle Default { |
bundle Default { |
||
class SayGoodbye { |
class SayGoodbye { |
||
Line 904: | Line 904: | ||
} |
} |
||
} |
} |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|OCaml}}== |
=={{header|OCaml}}== |
||
Line 910: | Line 910: | ||
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. |
||
< |
<syntaxhighlight lang="ocaml">print_string "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Oforth}}== |
=={{header|Oforth}}== |
||
< |
<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`. |
||
< |
<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: |
||
< |
<syntaxhighlight lang="ooc">main: func { |
||
"Goodbye, World!" print() |
"Goodbye, World!" print() |
||
}</ |
}</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.}} |
||
< |
<syntaxhighlight lang="oxygene"> |
||
namespace HelloWorld; |
namespace HelloWorld; |
||
Line 951: | Line 951: | ||
end. |
end. |
||
</syntaxhighlight> |
|||
</lang> |
|||
<pre> |
<pre> |
||
>HelloWorld.exe |
>HelloWorld.exe |
||
Line 958: | Line 958: | ||
=={{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."</ |
print " Nice having known you."</syntaxhighlight> |
||
=={{header|PARI/GP}}== |
=={{header|PARI/GP}}== |
||
< |
<syntaxhighlight lang="parigp">print1("Goodbye, World!")</syntaxhighlight> |
||
=={{header|Pascal}}== |
=={{header|Pascal}}== |
||
< |
<syntaxhighlight lang="pascal">program NewLineOmission(output); |
||
begin |
begin |
||
write('Goodbye, World!'); |
write('Goodbye, World!'); |
||
end.</ |
end.</syntaxhighlight> |
||
Output: |
Output: |
||
<pre>% ./NewLineOmission |
<pre>% ./NewLineOmission |
||
Line 978: | Line 978: | ||
=={{header|PASM}}== |
=={{header|PASM}}== |
||
< |
<syntaxhighlight lang="pasm">print "Goodbye World!" # Newlines do not occur unless we embed them |
||
end</ |
end</syntaxhighlight> |
||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
< |
<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. |
||
<!--< |
<!--<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> |
||
<!--</ |
<!--</syntaxhighlight>--> |
||
=={{header|PHL}}== |
=={{header|PHL}}== |
||
Printf doesn't add newline automatically. |
Printf doesn't add newline automatically. |
||
< |
<syntaxhighlight lang="phl">module helloworld_noln; |
||
extern printf; |
extern printf; |
||
Line 999: | Line 999: | ||
printf("Goodbye, World!"); |
printf("Goodbye, World!"); |
||
return 0; |
return 0; |
||
]</ |
]</syntaxhighlight> |
||
=={{header|PHP}}== |
=={{header|PHP}}== |
||
< |
<syntaxhighlight lang="php">echo "Goodbye, World !";</syntaxhighlight> |
||
=={{header|Picat}}== |
=={{header|Picat}}== |
||
< |
<syntaxhighlight lang="picat">print("Goodbye, World!")</syntaxhighlight> |
||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |
||
< |
<syntaxhighlight lang="picolisp">(prin "Goodbye, World!")</syntaxhighlight> |
||
=={{header|Pict}}== |
=={{header|Pict}}== |
||
< |
<syntaxhighlight lang="pict">(pr "Hello World!");</syntaxhighlight> |
||
=={{header|Pike}}== |
=={{header|Pike}}== |
||
< |
<syntaxhighlight lang="pike">write("Goodbye, World!");</syntaxhighlight> |
||
=={{header|Pixilang}}== |
=={{header|Pixilang}}== |
||
< |
<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}}== |
||
< |
<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.</ |
Shut down.</syntaxhighlight> |
||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |
||
< |
<syntaxhighlight lang="powershell">Write-Host -NoNewLine "Goodbye, " |
||
Write-Host -NoNewLine "World!"</ |
Write-Host -NoNewLine "World!"</syntaxhighlight> |
||
{{Out}} |
{{Out}} |
||
<pre>Goodbye, World!PS C:\></pre> |
<pre>Goodbye, World!PS C:\></pre> |
||
=={{header|Processing}}== |
=={{header|Processing}}== |
||
< |
<syntaxhighlight lang="processing"> |
||
print("Goodbye, World!"); /* No automatic newline */ |
print("Goodbye, World!"); /* No automatic newline */ |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |
||
< |
<syntaxhighlight lang="purebasic">OpenConsole() |
||
Print("Goodbye, World!") |
Print("Goodbye, World!") |
||
Input() ;wait for enter key to be pressed</ |
Input() ;wait for enter key to be pressed</syntaxhighlight> |
||
=={{header|Python}}== |
=={{header|Python}}== |
||
< |
<syntaxhighlight lang="python">import sys |
||
sys.stdout.write("Goodbye, World!")</ |
sys.stdout.write("Goodbye, World!")</syntaxhighlight> |
||
{{works with|Python|3.x}} |
{{works with|Python|3.x}} |
||
< |
<syntaxhighlight lang="python">print("Goodbye, World!", end="")</syntaxhighlight> |
||
=={{header|Quackery}}== |
=={{header|Quackery}}== |
||
Line 1,059: | Line 1,059: | ||
Quackery does not automatically insert a new line. |
Quackery does not automatically insert a new line. |
||
< |
<syntaxhighlight lang="quackery">say "Goodbye, world!"</syntaxhighlight> |
||
=={{header|R}}== |
=={{header|R}}== |
||
< |
<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,072: | Line 1,072: | ||
print "Goodbye, World!" without new line |
print "Goodbye, World!" without new line |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Racket}}== |
=={{header|Racket}}== |
||
< |
<syntaxhighlight lang="racket">#lang racket |
||
(display "Goodbye, World!")</ |
(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 |
<syntaxhighlight lang="raku" line>print "Goodbye, World!"; |
||
printf "%s", "Goodbye, World!";</ |
printf "%s", "Goodbye, World!";</syntaxhighlight> |
||
=={{header|RASEL}}== |
=={{header|RASEL}}== |
||
<lang>"!dlroW ,olleH">:?@,Gj</ |
<syntaxhighlight lang="text">"!dlroW ,olleH">:?@,Gj</syntaxhighlight> |
||
=={{header|REBOL}}== |
=={{header|REBOL}}== |
||
< |
<syntaxhighlight lang="rebol">prin "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Red}}== |
=={{header|Red}}== |
||
< |
<syntaxhighlight lang="red">prin "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Retro}}== |
=={{header|Retro}}== |
||
<lang |
<syntaxhighlight lang="retro">'Goodbye,_World! s:put</syntaxhighlight> |
||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
Line 1,100: | Line 1,100: | ||
<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. |
||
< |
<syntaxhighlight lang="rexx">/*REXX pgm displays a "Goodbye, World!" without a trailing newline. */ |
||
call charout ,'Goodbye, World!'</ |
call charout ,'Goodbye, World!'</syntaxhighlight> |
||
=={{header|Ring}}== |
=={{header|Ring}}== |
||
< |
<syntaxhighlight lang="ring">see "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
< |
<syntaxhighlight lang="ruby">print "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Run BASIC}}== |
=={{header|Run BASIC}}== |
||
< |
<syntaxhighlight lang="runbasic">print "Goodbye, World!";</syntaxhighlight> |
||
=={{header|Rust}}== |
=={{header|Rust}}== |
||
< |
<syntaxhighlight lang="rust">fn main () { |
||
print!("Goodbye, World!"); |
print!("Goodbye, World!"); |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Salmon}}== |
=={{header|Salmon}}== |
||
< |
<syntaxhighlight lang="salmon">print("Goodbye, World!");</syntaxhighlight> |
||
=={{header|Scala}}== |
=={{header|Scala}}== |
||
Line 1,125: | Line 1,125: | ||
===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: |
||
< |
<syntaxhighlight lang="scala">print("Goodbye, World!")</syntaxhighlight> |
||
=={{header|Scheme}}== |
=={{header|Scheme}}== |
||
< |
<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. |
||
< |
<syntaxhighlight lang="scilab">print("Goodbye, World!")</syntaxhighlight> |
||
=={{header|Seed7}}== |
=={{header|Seed7}}== |
||
< |
<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;</ |
end func;</syntaxhighlight> |
||
=={{header|SETL}}== |
=={{header|SETL}}== |
||
< |
<syntaxhighlight lang="setl">nprint( 'Goodbye, World!' );</syntaxhighlight> |
||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
< |
<syntaxhighlight lang="ruby">print "Goodbye, World!";</syntaxhighlight> |
||
or: |
or: |
||
< |
<syntaxhighlight lang="ruby">"%s".printf("Goodbye, World!");</syntaxhighlight> |
||
=={{header|Smalltalk}}== |
=={{header|Smalltalk}}== |
||
< |
<syntaxhighlight lang="smalltalk"> |
||
Transcript show: 'Goodbye, World!'. |
Transcript show: 'Goodbye, World!'. |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Standard ML}}== |
=={{header|Standard ML}}== |
||
< |
<syntaxhighlight lang="sml">print "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Swift}}== |
=={{header|Swift}}== |
||
{{works with|Swift|2.x+}} |
{{works with|Swift|2.x+}} |
||
< |
<syntaxhighlight lang="swift">print("Goodbye, World!", terminator: "")</syntaxhighlight> |
||
{{works with|Swift|1.x}} |
{{works with|Swift|1.x}} |
||
< |
<syntaxhighlight lang="swift">print("Goodbye, World!")</syntaxhighlight> |
||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
< |
<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 |
<syntaxhighlight lang="transact-sql"> PRINT 'Goodbye, World!'</syntaxhighlight> |
||
or: |
or: |
||
As a result set |
As a result set |
||
<lang |
<syntaxhighlight lang="transact-sql"> select 'Goodbye, World!'</syntaxhighlight> |
||
=={{header|TUSCRIPT}}== |
=={{header|TUSCRIPT}}== |
||
< |
<syntaxhighlight lang="tuscript"> |
||
$$ MODE TUSCRIPT |
$$ MODE TUSCRIPT |
||
PRINT "Goodbye, World!" |
PRINT "Goodbye, World!" |
||
</syntaxhighlight> |
|||
</lang> |
|||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 1,187: | Line 1,187: | ||
=={{header|TXR}}== |
=={{header|TXR}}== |
||
Possible using access to standard output stream via TXR Lisp: |
Possible using access to standard output stream via TXR Lisp: |
||
< |
<syntaxhighlight lang="bash">$ txr -e '(put-string "Goodbye, world!")' |
||
Goodbye, world!$</ |
Goodbye, world!$</syntaxhighlight> |
||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |
||
Line 1,195: | Line 1,195: | ||
{{works with|Bourne Shell}} |
{{works with|Bourne Shell}} |
||
< |
<syntaxhighlight lang="bash">printf "Goodbye, World!" # This works. There is no newline. |
||
printf %s "-hyphens and % signs" # Use %s with arbitrary strings.</ |
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: |
||
< |
<syntaxhighlight lang="bash">echo -n 'Goodbye, World!'</syntaxhighlight> |
||
or |
or |
||
< |
<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,210: | Line 1,210: | ||
{{works with|zsh}} |
{{works with|zsh}} |
||
< |
<syntaxhighlight lang="bash">print -n "Goodbye, World!" |
||
print -nr -- "-hyphens and \backslashes"</ |
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. |
||
< |
<syntaxhighlight lang="csh">echo -n "Goodbye, World!" |
||
echo -n "-hyphens and \backslashes"</ |
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. |
||
< |
<syntaxhighlight lang="ursa">out "goodbye world!" console</syntaxhighlight> |
||
=={{header|Verbexx}}== |
=={{header|Verbexx}}== |
||
< |
<syntaxhighlight lang="verbexx">@STDOUT "Goodbye, World!";</syntaxhighlight> |
||
=={{header|Verilog}}== |
=={{header|Verilog}}== |
||
< |
<syntaxhighlight lang="verilog">module main; |
||
initial |
initial |
||
begin |
begin |
||
Line 1,234: | Line 1,234: | ||
$finish ; |
$finish ; |
||
end |
end |
||
endmodule</ |
endmodule</syntaxhighlight> |
||
=={{header|Vim Script}}== |
=={{header|Vim Script}}== |
||
< |
<syntaxhighlight lang="vim">echon "Goodbye, World!"</syntaxhighlight> |
||
=={{header|Visual Basic .NET}}== |
=={{header|Visual Basic .NET}}== |
||
< |
<syntaxhighlight lang="vbnet">Module Module1 |
||
Sub Main() |
Sub Main() |
||
Line 1,247: | Line 1,247: | ||
End Sub |
End Sub |
||
End Module</ |
End Module</syntaxhighlight> |
||
=={{header|Vlang}}== |
=={{header|Vlang}}== |
||
< |
<syntaxhighlight lang="vlang">fn main() { print("Goodbye, World!") }</syntaxhighlight> |
||
=={{header|Web 68}}== |
=={{header|Web 68}}== |
||
Line 1,256: | Line 1,256: | ||
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' |
||
< |
<syntaxhighlight lang="web68">@ @a@=#!/usr/bin/a68g -nowarn@>@\BEGIN print("Hello World") END</syntaxhighlight> |
||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
< |
<syntaxhighlight lang="ecmascript">System.write("Goodbye, World!")</syntaxhighlight> |
||
=={{header|XLISP}}== |
=={{header|XLISP}}== |
||
Either |
Either |
||
< |
<syntaxhighlight lang="scheme">(display "Goodbye, World!")</syntaxhighlight> |
||
or |
or |
||
< |
<syntaxhighlight lang="lisp">(princ "Goodbye, World!")</syntaxhighlight> |
||
=={{header|XPath}}== |
=={{header|XPath}}== |
||
<lang |
<syntaxhighlight lang="xpath">'Goodbye, World!'</syntaxhighlight> |
||
=={{header|XPL0}}== |
=={{header|XPL0}}== |
||
< |
<syntaxhighlight lang="xpl0">code Text=12; |
||
Text(0, "Goodbye, World!")</ |
Text(0, "Goodbye, World!")</syntaxhighlight> |
||
=={{header|XSLT}}== |
=={{header|XSLT}}== |
||
< |
<syntaxhighlight lang="text"><xsl:text>Goodbye, World!</xsl:text></syntaxhighlight> |
||
=={{header|zkl}}== |
=={{header|zkl}}== |
||
< |
<syntaxhighlight lang="zkl">print("Goodbye, World!"); |
||
Console.write("Goodbye, World!");</ |
Console.write("Goodbye, World!");</syntaxhighlight> |
||
=={{header|Zig}}== |
=={{header|Zig}}== |
||
< |
<syntaxhighlight lang="zig">const std = @import("std"); |
||
pub fn main() !void { |
pub fn main() !void { |
||
try std.io.getStdOut().writer().writeAll("Hello world!"); |
try std.io.getStdOut().writer().writeAll("Hello world!"); |
||
}</ |
}</syntaxhighlight> |
||
=={{header|ZX Spectrum Basic}}== |
=={{header|ZX Spectrum Basic}}== |
||
< |
<syntaxhighlight lang="basic">10 REM The trailing semicolon prevents a newline |
||
20 PRINT "Goodbye, World!";</ |
20 PRINT "Goodbye, World!";</syntaxhighlight> |
||
{{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}} |