error
Global, available without an import
error(...)
Writes its arguments to the error stream.
error("squad wiped:", "no ammo left") // goes to stderr, not stdout
println("\nstdout: still running") // error() does not stop the script; adds no newline of its ownOutput:
squad wiped: no ammo left
stdout: still runningParameters
... | any | values to write; each is converted the same way print converts its arguments repeats |
Return value
null.
Notes
Goes to the error stream (stderr on the command-line host), a stream print and println never touch. Several arguments are joined with a single space, same as print, and error adds no trailing newline of its own, same as print too - call errorln for that.
The example on this page prints on both streams. The site's exec-test runner captures them merged into one file, in the order each write happened (the host disables output buffering to keep that order stable), so a mix of print-family and error-family calls is safe to commit here.
Example
println("stdout: starting")
error("stderr:", "something went wrong") // several arguments join with one space, like print
errorln("") // error() itself adds no trailing newline
println("stdout: continuing")Output:
stdout: starting
stderr: something went wrong
stdout: continuingSee also
errorln | Writes its arguments to the error stream, followed by a newline. |
print | Writes its arguments to the output stream. |
| globals | module index |