Hello world/Standard error: Difference between revisions
→{{header|langur}}
(Add Zig example) |
Langurmonkey (talk | contribs) |
||
(39 intermediate revisions by 26 users not shown) | |||
Line 6:
{{omit from|Brainf***}}
{{omit from|dc|Always prints to standard output.}}
{{omit from|EasyLang|EasyLang has an error variable, but it cannot be set manually. And it always prints to standard output.}}
{{omit from|GUISS|Cannot customize error messages}}
{{omit from|Integer BASIC}}
Line 31 ⟶ 32:
{{trans|Python}}
<
=={{header|4DOS Batch}}==
<syntaxhighlight lang
=={{header|AArch64 Assembly}}==
<
.equ SVC_WRITE, 64
.equ SVC_EXIT, 93
Line 57 ⟶ 58:
svc #0 // exit(0);
msg: .ascii "Goodbye World!\n"</
=={{header|Ada}}==
<
procedure Goodbye_World is
begin
Put_Line (Standard_Error, "Goodbye, World!");
end Goodbye_World;</
=={{header|Agena}}==
<
=={{header|Aime}}==
<
=={{header|ALGOL 68}}==
Line 82 ⟶ 83:
{{works with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68toc/algol68toc-1.8.8d/algol68toc-1.8-8d.fc9.i386.rpm/download 1.8-8d] - note that printf and putf were not ported into ELLA's libraries.}}
<
put(stand error, ("Goodbye, World!", new line))
)</
{{out}}
<pre>
Line 91 ⟶ 92:
=={{header|Argile}}==
<
eprint "Goodbye, World!"</
or
<
eprintf "Goodbye, World!\n"</
or
<
fprintf stderr "Goodbye, World!\n"</
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
<syntaxhighlight lang="arm assembly">
/* ARM assembly Raspberry PI */
/* program hellowordLP.s */
Line 123 ⟶ 125:
iAdrMessage: .int szMessage
</syntaxhighlight>
=={{header|Arturo}}==
<
=={{header|ATS}}==
<
=={{header|AutoHotkey}}==
requires [http://github.com/tinku99/ahkdll/tree/master AutoHotkey_N]
implementation.
<
FileAppend, Goodbye`, World!, stderr ; requires AutoHotkey_N</
Or with the current AutoHotkey_L:
{{works with|AutoHotkey_L}}
(documentation on this behavior: http://www.autohotkey.net/~Lexikos/AutoHotkey_L/docs/commands/FileAppend.htm)
<
=={{header|AutoIt}}==
<
=={{header|Avail}}==
<syntaxhighlight lang="avail">Error: "Goodbye, World!";</syntaxhighlight>
=={{header|AWK}}==
Line 149 ⟶ 154:
pipe it through a shell command:
<
print "Goodbye, World!"| "cat 1>&2"
}</
Or write to /dev/stderr:
Line 158 ⟶ 163:
{{works with|mawk}}
{{works with|nawk}}
<
print "Goodbye, World!" > "/dev/stderr"
}</
With ''gawk'', ''mawk'' and ''nawk'': a special feature
Line 174 ⟶ 179:
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
<syntaxhighlight lang="basic">REM FILE-BASED OUTPUT REDIRECTION
0 D$ = CHR$ (4):F$ = "DEV/STDERR": PRINT D$"OPEN"F$: PRINT D$"CLOSE"F$: PRINT D$"APPEND"F$: PRINT D$"WRITE"F$
1 PRINT "GOODBYE, WORLD!"
2 PRINT D$"CLOSE"F$</syntaxhighlight><syntaxhighlight lang="basic">REM OUTPUT ROUTINE REDIRECTION
3 FOR I = 768 TO 802: READ B: POKE I,B: NEXT : POKE 54,0: POKE 55,3: CALL 1002: DATA 72,173,34,3,208,8,169,191,141,34,3,32,240,253,104,201,141,208,12,169,0,141,34,3,169,135,32,240,253,169,141,76,240,253,0
4 O$ = CHR$ (111):D$ = CHR$ (100): PRINT "G" + O$ + O$ + D$ + CHR$ (98) + CHR$ (121) + CHR$ (101) + ", W" + O$ + CHR$ (114) + CHR$ (108) + D$ + "!"
5 POKE 54,240: POKE 55,253: CALL 1002</syntaxhighlight>
==={{header|BaCon}}===
<
==={{header|
<syntaxhighlight lang="basic256">onerror errortrap
throwerror 99
end
errortrap:
print "Goodbye World!"
return</syntaxhighlight>
==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
<syntaxhighlight lang="qbasic">10 cls
20 on error goto 50
30 error 99 : we force an error
40 end
50 rem ManejoErrores
60 print "Goodbye World!"
70 cont</syntaxhighlight>
==={{header|QBasic}}===
<syntaxhighlight lang="basic">ON ERROR GOTO ManejoErrores
ERROR 99
END
ManejoErrores:
PRINT "Googbye World!"
RESUME</syntaxhighlight>
==={{header|ZX Spectrum Basic}}===
On the ZX Spectrum, standard error is on stream 1:
<syntaxhighlight lang="zxbasic">10 PRINT #1;"Goodbye, World!"
20 PAUSE 50: REM allow time for the user to see the error message</syntaxhighlight>
=={{header|Batch File}}==
<
The redirection operator <code>1>&2</code> causes all output on stream 1 (standard out) to be redirected to stream 2 (standard error).
The redirection can be moved to the end of the line, too.
Line 195 ⟶ 232:
{{works with|BBC BASIC for Windows}}
The program must be compiled as a console application for this to work.
<
SYS "GetStdHandle", STD_ERROR_HANDLE TO @hfile%(1)
PRINT #13, "Goodbye, World!"
QUIT</
=={{header|Blade}}==
<syntaxhighlight lang="blade">import io
io.stderr.write('Goodbye, World!')</syntaxhighlight>
=={{header|C}}==
Unlike puts(), fputs() does not append a terminal newline.
<
int main()
Line 210 ⟶ 251:
return 0;
}</
=={{header|C sharp|C#}}==
<
{
static void Main(string[] args)
Line 219 ⟶ 260:
Console.Error.WriteLine("Goodbye, World!");
}
}</
=={{header|C++}}==
<
int main() {
std::cerr << "Goodbye, World!\n";
}</
=={{header|Clojure}}==
<
(println "Goodbye, world!"))</
=={{header|CLU}}==
<syntaxhighlight lang="clu">start_up = proc ()
stream$putl(stream$error_output(), "Goodbye, World!")
end start_up</syntaxhighlight>
=={{header|CMake}}==
Most messages go to standard error.
<
The message cannot be a keyword; <code>message("STATUS")</code> never prints "STATUS", but <code>message("" "STATUS")</code> does work.
Line 243 ⟶ 289:
{{works with|OpenCOBOL}}
<
procedure division.
display "Goodbye, world!" upon syserr.
stop run.</
=={{header|CoffeeScript}}==
{{trans|JavaScript}}
{{works with|Node.js}}
<
=={{header|Common Lisp}}==
<
=={{header|D}}==
<
void main () {
stderr.writeln("Goodbye, World!");
}</
===Alternative Version===
{{libheader|tango}}
<
void main () {
Stderr("Goodbye, World!").newline;
}</
=={{header|
<syntaxhighlight lang="dart">import 'dart:io';
void main() {
stderr.writeln('Goodbye, World!');
}</syntaxhighlight>
=={{header|Delphi}}==
<
{$APPTYPE CONSOLE}
Line 281 ⟶ 331:
begin
WriteLn(ErrOutput, 'Goodbye, World!');
end.</
=={{header|dt}}==
<syntaxhighlight lang="dt">"Goodbye, World!" epl</syntaxhighlight>
=={{header|Dylan.NET}}==
Line 292 ⟶ 345:
{{works with|.NET|4.5}}
One Line version:
<
Goodbye World Program:
<syntaxhighlight lang="dylan.net">
//compile using the new dylan.NET v, 11.5.1.2 or later
//use mono to run the compiler
Line 311 ⟶ 364:
end class
</syntaxhighlight>
=={{header|Déjà Vu}}==
<syntaxhighlight lang="dejavu">!write-fragment!stderr !encode!utf-8 "Goodbye, World!\n"</syntaxhighlight>
=={{header|E}}==
<
=={{header|Elixir}}==
<
=={{header|Emacs Lisp}}==
In batch mode, <code>message</code> actually prints to standard error:
<syntaxhighlight lang="lisp">(message "Goodbye, World!")</syntaxhighlight>
For greater control, <code>princ</code> can be used with a special printing function:
<syntaxhighlight lang="lisp">(princ "Goodbye, World!\n" 'external-debugging-output)</syntaxhighlight>
=={{header|EMal}}==
<syntaxhighlight lang="emal">logLine("Goodbye, World!")</syntaxhighlight>
<syntaxhighlight lang="emal">log("Goodbye, World!")</syntaxhighlight>
=={{header|Erlang}}==
<
=={{header|Euphoria}}==
<
=={{header|F_Sharp|F#}}==
<
or you can use the .Net classes
<
=={{header|Factor}}==
Start Factor in a terminal for this:
<
=={{header|Fantom}}==
<
class Main
{
Line 354 ⟶ 415:
}
}
</syntaxhighlight>
=={{header|Forth}}==
{{works with|GNU Forth}}
<
stderr to outfile-id
." Goodbye, World!" cr
to outfile-id</
=={{header|Fortran}}==
Line 370 ⟶ 431:
which defines the parameter ERROR_UNIT.
<
! Fortran 2003
use iso_fortran_env
Line 378 ⟶ 439:
write (ERROR_UNIT, *) "Goodbye, World!"
end program StdErr</
=={{header|FreeBASIC}}==
<
Open Err As #1
Print #1, "Goodbye World!"
Close #1
Sleep</
=={{header|Frink}}==
<
staticJava["java.lang.System","err"].println["Goodbye, World!"]
</syntaxhighlight>
=={{header|Genie}}==
<
/*
Hello, to Standard error, in Genie
Line 401 ⟶ 462:
init
stderr.printf("%s\n", "Goodbye, World!")</
{{out}}
Line 410 ⟶ 471:
=={{header|Go}}==
Built in println now goes to stderr.
<
func main() { println("Goodbye, World!") }</
but the builtin print() and println() functions are not guaranteed to stay in the language. So you should probably use
<
import ("fmt"; "os")
func main() { fmt.Fprintln(os.Stderr, "Goodbye, World!") }</
=={{header|Groovy}}==
<
=={{header|Haskell}}==
<
main = hPutStrLn stderr "Goodbye, World!"</
=={{header|Huginn}}==
<
exec huginn --no-argv -E "${0}" "${@}"
#! huginn
Line 434 ⟶ 495:
os.stderr().write( "Goodbye, World!\n" );
return ( 0 );
}</
=={{header|Icon}} and {{header|Unicon}}==
<
write(&errout, "Goodbye World" )
end</
=={{header|J}}==
<syntaxhighlight lang="j"> stderr
1!:2&5
0 0 $ stderr 'Goodbye, World!'</syntaxhighlight>
=={{header|Java}}==
<
public static void main(String[] args){
System.err.println("Goodbye, World!");
}
}</
=={{header|JavaScript}}==
{{works with|JScript}} and only with <code>cscript.exe</code>
<
{{works with|Node.js}}
<
{{works with|Firefox}}
<
OR
<
=={{header|
<syntaxhighlight lang="joy">stderr "Goodbye, World!\n" fputchars pop.</syntaxhighlight>
=={{header|jq}}==
<syntaxhighlight lang="jq">jq -n —-arg s 'Goodbye, World!' '$s | stderr | empty'</syntaxhighlight>
`stderr` copies its input to STDERR before passing it along the pipeline, and hence the occurrence of `empty` above.
=={{header|Julia}}==
Julia 0.7 or newer:
<syntaxhighlight lang="julia">println(stderr, "Goodbye, World!")</syntaxhighlight>
In versions prior to Julia 0.7, the standard I/O streams were capitalized:
<syntaxhighlight lang="julia">println(STDERR, "Goodbye, World!")</syntaxhighlight>
=={{header|Kotlin}}==
<
System.err.println("Goodbye, World!")
}</
=={{header|Lang}}==
<syntaxhighlight lang="lang">fn.errorln(Goodbye, World!)</syntaxhighlight>
=={{header|langur}}==
<
=={{header|Lasso}}==
<
file_stderr->writeBytes(#s->asBytes)
}
stderr('Goodbye, World!')</
=={{header|Lingo}}==
*Windows:
{{libheader|CommandLine Xtra}}
<
stdErr("Goodbye, World!", TRUE)
-- print to the Windows debug console (shown in realtime e.g. in Systernal's DebugView)
dbgPrint("Goodbye, World!")</
*Mac OS X:
{{libheader|Shell Xtra}}
<
-- print to standard error
Line 505 ⟶ 579:
-- print to system.log (shown in realtime e.g. in Konsole.app)
sx.shell_cmd("logger Goodbye, World!")</
=={{header|Lean}}==
In lean4
<syntaxhighlight lang="lean4">
def main : IO Unit := do
let stderr ← IO.getStderr
stderr.putStrLn s!"Goodbye, World!"
</syntaxhighlight>
=={{header|LLVM}}==
<
; 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.
Line 532 ⟶ 613:
;-- exit
ret i32 0
}</
{{out}}
<pre>Goodbye, world!</pre>
Line 538 ⟶ 619:
=={{header|Logtalk}}==
The stream alias "user_error" can be used to print to the "standard error" stream.
<
:- object(error_message).
Line 546 ⟶ 627:
:- end_object.
</syntaxhighlight>
=={{header|Lua}}==
<
=={{header|m4}}==
<
')dnl</
=={{header|MANOOL}}==
<
=={{header|Maple}}==
<syntaxhighlight lang="maple">
error "Goodbye World"
</syntaxhighlight>
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<
=={{header|MATLAB}} / {{header|Octave}}==
This prints to standard error, and continues execution
<
This will not stop further execution, if called from within a script or function.
<syntaxhighlight lang
=={{header|Mercury}}==
<syntaxhighlight lang="text">
:- module hello_error.
:- interface.
Line 585 ⟶ 666:
io.stderr_stream(Stderr, !IO),
io.write_string(Stderr, "Goodbye, World!\n", !IO).
</syntaxhighlight>
=={{header|Metafont}}==
Metafont has no a real way to send a text to the standard output/error nor to a file. Anyway it exists the <code>errmessage</code> command which will output an error message and prompt the user for action (suspending the interpretation of the source).
<
message "...going on..."; % if the user decides to go on and not to stop
% the program because of the error.</
=={{header|min}}==
{{works with|min|0.37.0}}
Currently, ''min'' has three possibilities for outputting to stderr:
<syntaxhighlight lang="min">"Goodbye, World!" warn!
"Goodbye, World!" error!
"Goodbye, World!" fatal!</syntaxhighlight>
The first two depend on the current log level (and are enabled by default). The last one additionally terminates the program.
=={{header|ML/I}}==
<
MCNOTE Goodbye, World!</
=={{header|Miranda}}==
<syntaxhighlight lang="miranda">main :: [sys_message]
main = [Stderr "Hello, world!\n"]</syntaxhighlight>
=={{header|Modula-2}}==
<
IMPORT StdError;
Line 605 ⟶ 698:
StdError.WriteString('Goodbye, World!');
StdError.WriteLn
END HelloErr.</
=={{header|Modula-3}}==
<
IMPORT Wr, Stdio;
Line 614 ⟶ 707:
BEGIN
Wr.PutText(Stdio.stderr, "Goodbye, World!\n");
END Stderr.</
=={{header|N/t/roff}}==
Line 620 ⟶ 713:
The request <code>.tm</code> prints whatever after it, until and including the newline character, to the standard error. The string parsed to it need not be quoted and will never appear on standard output.
<
.tm Goodbye, World!
</syntaxhighlight>
=={{header|Neko}}==
<syntaxhighlight lang="actionscript">/**
Hello world, to standard error, in Neko
Tectonics:
Line 638 ⟶ 731:
var stderr = $loader.loadprim("std@file_stderr", 0)();
file_write(stderr, "Goodbye, World!\n", 0, 16);</
{{out}}
Line 648 ⟶ 741:
=={{header|Nemerle}}==
<
=={{header|NetRexx}}==
<
options replace format comments java crossref savelog symbols binary
System.err.println("Goodbye, World!")
</syntaxhighlight>
=={{header|Nim}}==
<
=={{header|Nu}}==
<syntaxhighlight lang="nu">
print -e "Goodbye, World!"
</syntaxhighlight>
=={{header|Oberon-2}}==
Oxford Oberon-2
<
MODULE HelloErr;
IMPORT Err;
Line 669 ⟶ 767:
Err.String("Goodbye, World!");Err.Ln
END HelloErr.
</syntaxhighlight>
{{out}}
<pre>
Line 683 ⟶ 781:
is an NSString object, and it also prepends a timestamp.
<
int main()
Line 691 ⟶ 789:
NSLog(@"Goodbye, World!");
return 0;
}</
=={{header|OCaml}}==
<
Printf.eprintf "Goodbye, World!\n"; (* this is how you would use printf with stderr *)</
we can also use the ''out_channel'' '''stderr''':
<
Printf.fprintf stderr "Goodbye, World!\n";</
finally the [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Unix.html Unix] module also provides unbuffered write functions:
<
ignore(Unix.write Unix.stderr msg 0 (String.length msg)) ;;</
=={{header|Octave}}==
<
=={{header|Oforth}}==
<
=={{header|Ol}}==
<
(print-to stderr "Goodbye, World!")
</syntaxhighlight>
=={{header|ooRexx}}==
ooRexx provides a .error object that writes output to the standard error stream.
<
The .error object is a proxy that delegates to a backing stream, so this might be redirected.
By default, this delegates to the .stderr object, which can also be used directly.
<
or in 'Classic REXX style'
<
* 07.07.2014 Walter Pachl
* 12.07.2014 WP see Discussion where redirection from within the program is shown
Line 733 ⟶ 831:
Call lineout ,'Hello, world!'
Say 'and this is the error output:'
'type err.txt' </
=={{header|Oz}}==
<
import Application System
define
{System.showError "Goodbye, World!"}
{Application.exit 0}
end</
=={{header|PARI/GP}}==
<
=={{header|Pascal}}==
{{Works with|Free Pascal}}
<
begin
writeln(StdErr, 'Goodbye, World!');
end.</
=={{header|Perl}}==
<
Or:
<
=={{header|Phix}}==
<!--<syntaxhighlight lang="phix">-->
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">2</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Goodbye, World!"</span><span style="color: #0000FF;">)</span>
<!--</syntaxhighlight>-->
=={{header|PHP}}==
<
or
<
=={{header|Picat}}==
<syntaxhighlight lang="picat">println(stderr,"Goodbye, World!")</syntaxhighlight>
=={{header|PicoLisp}}==
<
=={{header|Pike}}==
<
=={{header|PL/I}}==
<
=={{header|PostScript}}==
<
(Goodbye, World!
) writestring
closefile</
=={{header|PowerBASIC}}==
{{works with|PowerBASIC Console Compiler}}
<
=={{header|PowerShell}}==
Line 797 ⟶ 897:
standard Write-Error cmdlet is mainly for sending annotated error messages
to the host:
<
Note that this outputs more than just the message,
because behind the scenes it is an uncaught exception:
Line 804 ⟶ 904:
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException</pre>
To accurately reproduce the behavior of other languages one has to resort to .NET in this case:
<
=={{header|PureBasic}}==
Line 812 ⟶ 912:
Standard error output can be used in conjunction with [http://www.purebasic.com/documentation/process/readprogramerror.html ReadProgramError()] to reads a line from an other programs error output (stderr).
<
=={{header|Python}}==
{{works with|Python|2.x}}
<
print >> sys.stderr, "Goodbye, World!"</
{{works with|Python|3.x}}
<
print("Goodbye, World!", file=sys.stderr)</
Works with either:
<
sys.stderr.write("Goodbye, World!\n")</
=={{header|R}}==
<
=={{header|Ra}}==
<syntaxhighlight lang="ra">
class HelloWorld
**Prints "Goodbye, World!" to standard error**
Line 841 ⟶ 941:
print to Console.error made !, "Goodbye, World!"
</syntaxhighlight>
=={{header|Racket}}==
<syntaxhighlight lang="racket">
(eprintf "Goodbye, World!\n")
</syntaxhighlight>
=={{header|Raku}}==
(formerly Perl 6)
<syntaxhighlight lang="raku" line>note "Goodbye, World!";</syntaxhighlight>
=={{header|Retro}}==
<
=={{header|REXX}}==
Line 858 ⟶ 962:
<br>If the '''stderr''' name is supported and enabled, the output is written to the terminal.
<br>If not supported or disabled, the output is written to a (disk) file named '''STDERR'''.
<
===version 2===
Same as above, but uses a different style and also invokes '''charout''' instead of '''lineout'''.
<
call charout 'STDERR', msgText</
===version 3===
<
* 07.07.2014 Walter Pachl
* enter the appropriate command shown in a command prompt.
Line 880 ⟶ 984:
Call lineout ,'Hello, world!'
Say 'and this is the error output:'
'type err.txt'</
===version 4===
ARexx with tracing console
<syntaxhighlight lang="rexx">/**/
Address command tco
Call writeln stderr,'Good bye, world!'
Call writeln stdout,'Hello, world!'</syntaxhighlight>
=={{header|Ring}}==
<
=={{header|RPL}}==
There is no error console in RPL but all error messages are displayed at the top two lines of the display, which freezes until a key is pressed.
This can be mimicked with the <code>DISP</code> instruction:
≪ "Hello world!" 1 DISP ≫
=={{header|Ruby}}==
<
The following also works, unless you have disabled warnings (ruby command line option "-W0" or set <code>$VERBOSE=nil</code>)
<
=={{header|Run BASIC}}==
<
window.open('','error_msg','');
document.write('Goodbye, World!');
</script>""</
Run Basic runs in a browser.
This opens a new browser window,
Line 900 ⟶ 1,016:
=={{header|Rust}}==
<
eprintln!("Hello, {}!", "world");
}</
or
<
use ::std::io::Write;
let (stderr, errmsg) = (&mut ::std::io::stderr(), "Error writing to stderr");
Line 911 ⟶ 1,027:
let (goodbye, world) = ("Goodbye", "world");
writeln!(stderr, "{}, {}!", goodbye, world).expect(errmsg);
}</
or
<
use std::io::{self, Write};
Line 922 ⟶ 1,038:
io::stderr().write(&*format!("{}, {}!", goodbye, world).as_bytes()).expect("Could not write to stderr");
// Clearly, if you want formatted strings there's no reason not to just use writeln!
}</
=={{header|S-lang}}==
<
=={{header|Salmon}}==
<syntaxhighlight lang="salmon">
standard_error.print("Goodbye, World!\n");
</syntaxhighlight>
or
<syntaxhighlight lang="salmon">
include "short.salm";
stderr.print("Goodbye, World!\n");
</syntaxhighlight>
or
<syntaxhighlight lang="salmon">
include "shorter.salm";
err.print("Goodbye, World!\n");
</syntaxhighlight>
or
<syntaxhighlight lang="salmon">
include "shorter.salm";
se.print("Goodbye, World!\n");
</syntaxhighlight>
=={{header|Sather}}==
<
main is
#ERR + "Hello World!\n";
end;
end;</
=={{header|Scala}}==
Line 965 ⟶ 1,081:
===Ad hoc REPL solution===
Ad hoc solution as [http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop REPL] script:
<
===Via Java runtime===
This is a call to the Java run-time library. '''Not recommendated'''.
<
===Via Scala Console API===
This is a call to the Scala API. '''Recommendated'''.
<
===Short term deviation to err===
<
===Long term deviation to err===
<
Console.setOut(Console.err)
println ("Out deviated")
Console.setOut(Console.out) // Reset to normal</
=={{header|Scheme}}==
<syntaxhighlight lang="scheme">(error "Goodbye, World!")</syntaxhighlight>
=={{header|Scilab}}==
<
=={{header|sed}}==
Requires <tt>/dev/stderr</tt>
<
1 {
s/.*/Goodbye, World!/w /dev/stderr
}</
This program requires at least 1 line of input.
Line 1,004 ⟶ 1,120:
{{out|Test output}}
<
Goodbye, World!</
=={{header|Seed7}}==
<
const proc: main is func
begin
writeln(STD_ERR, "Goodbye, World!");
end func;</
=={{header|Sidef}}==
<
=={{header|Slate}}==
<
=={{header|Slope}}==
<syntaxhighlight lang="slope">(write "Goodbye, world!" stderr)</syntaxhighlight>
=={{header|Smalltalk}}==
The details on to which name stderr is bound may vary between Smalltalk dialects. If different, a "Smalltalk at:#Stderr put:<name your stream here>" should provide compatibility.
<syntaxhighlight lang="smalltalk">Stderr nextPutAll: 'Goodbye, World!'</syntaxhighlight>
However, all Smalltalks provide a console named "Transcript", where diagnostics is usually sent to (which is convenient, if there is no stderr to look at, as when started in Windows as an exe, vs. a com).<br>Thus:
<syntaxhighlight lang="smalltalk">Transcript show: 'Goodbye, World!'</syntaxhighlight>
will work on all, and is the preferred way to do this.
The above tells the stream to write a string;
you can also tell the string to print itself onto some stream:
<syntaxhighlight lang="smalltalk">'Goodbye, World!' printOn: Stderr</syntaxhighlight>
Both have the same effect.
=={{header|SNOBOL4}}==
<
output = "Normal text"
end</
=={{header|Standard ML}}==
<
=={{header|Swift}}==
<
let out = NSOutputStream(toFileAtPath: "/dev/stderr", append: true)
Line 1,052 ⟶ 1,174:
if let bytes = success {
println("\nWrote \(bytes) bytes")
}</
{{out}}
<pre>
Line 1,060 ⟶ 1,182:
=={{header|Tcl}}==
<
=={{header|Transact-SQL}}==
<
=={{header|True BASIC}}==
<syntaxhighlight lang="basic">
CAUSE error 1, "Goodbye World!"
END
</syntaxhighlight>
=={{header|TUSCRIPT}}==
<
$$ MODE TUSCRIPT
PRINT/ERROR "hello world"
text="goodbye world"
PRINT/ERROR text
</syntaxhighlight>
{{out}}
<pre>
Line 1,080 ⟶ 1,208:
=={{header|UNIX Shell}}==
{{works with|Bourne Shell}}
<
==={{header|C Shell}}===
<
This requires <code>/dev/stderr</code>, a device node from [[BSD]]
Line 1,090 ⟶ 1,218:
=={{header|Ursa}}==
<
=={{header|VBA}}==
<syntaxhighlight lang="vb">
Sub StandardError()
Debug.Print "Goodbye World!"
End Sub
</syntaxhighlight>
=={{header|VBScript}}==
Must work in cscript.exe
<
=={{header|Verbexx}}==
<
=={{header|Visual Basic .NET}}==
<
Sub Main()
Line 1,113 ⟶ 1,241:
End Sub
End Module</
=={{header|WDTE}}==
<
=={{header|Wren}}==
<syntaxhighlight lang="wren">Fiber.abort("Goodbye, World!")</syntaxhighlight>
=={{header|X86 Assembly}}==
Line 1,126 ⟶ 1,257:
Prints "Goodbye, World!" to stderr (and there is probably an even simpler version):
<
msg db 'Goodbye, World!', 0AH
len equ $-msg
Line 1,140 ⟶ 1,271:
mov ebx, 1
mov eax, 1
int 80h</
=={{header|XLISP}}==
<
=={{header|XPL0}}==
Line 1,153 ⟶ 1,284:
which is device 2.
<
Text(2, "Goodbye, World!")</
=={{header|Yabasic}}==
<syntaxhighlight lang="yabasic">
error "Goodbye World!"
</syntaxhighlight>
=={{header|Zig}}==
'''Works with:''' 0.10.x, 0.11.x, 0.12.0-dev.1357+10d03acdb
Variant with error handling:
<syntaxhighlight lang="zig">const std = @import("std");
pub fn main() std.fs.File.WriteError!void {
const stderr = std.io.getStdErr();
try stderr.writeAll("Goodbye, World!\n");
}</syntaxhighlight>
'''Works with:''' 0.10.x, 0.11.x, 0.12.0-dev.1357+10d03acdb
Variant with no error handling (useful when debugging):
<syntaxhighlight lang="zig">const std = @import("std");
pub fn main() void {
// Silently returns if writing to stderr fails.
std.debug.print("Goodbye, World!\n", .{});
}</syntaxhighlight>
=={{header|zkl}}==
<
|