Logo

Programming-Idioms

Print the message "x is negative" to standard error (stderr), with integer x value substitution (e.g. "-2 is negative").
Implementation
Scala

Implementation edit is for fixing errors and enhancing with metadata. Please do not replace the code below with a different implementation.

Instead of changing the code of the snippet, consider creating another Scala implementation.

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
import "os"
fmt.Fprintln(os.Stderr, x, "is negative")
System.err.format("%d is negative\n",x);
print STDERR "$x is negative";
eprintln!("{} is negative", x);
#include <stdio.h>
fprintf(stderr,"%d is negative\n",x);
import std.stdio;
stderr.writeln(x, " is negative");
import sys
print(x, "is negative", file=sys.stderr)
writeln(StdErr, Format('%d is negative',[-2]));
import "dart:io";
stderr.write("$x is negative");
warn "#{x} is negative"
$stderr.puts "%d is negative" % x
IO.puts :stderr, "#{x} is negative"
import System.IO (hPutStrLn, stderr)
hPutStrLn stderr (show (x) ++ " is negative")
with Ada.Text_IO;
use Ada.Text_IO;
Put_Line (Standard_Error, Integer'Image (X) & " is negative");
fwrite(STDERR, "{$x} is negative\n");
io:format(standard_error, "~p is negative~n", [X]).
io.stderr:write(string.format("%d is negative\n",x))
writeln(StdErr , x , ' is negative');
#include <iostream>
std::cerr << x << " is negative\n";
const util = require("util");
console.error(util.format("%d is negative", x));
console.error(x, "is negative");
import System;
Console.Error.WriteLine($"{x} is negative");
(format *error-output*
        "~a is negative"
        x)
(binding [*out* *err*]
  (println (str x " is negative")))
System.err.println("$x is negative")
program write_to_stderr
   use iso_fortran_env, only : stderr=>ERROR_UNIT   
   implicit none
   integer :: x=-2
   write(stderr,'(i0," is negative")') x
end program write_to_stderr
#include<iostream>
int main(){
	int x = -2;
	std::cerr << x <<" is negative\n";
}
console.error(`${x} is negative`);
@import Foundation;
NSLog(@"%d is negative",x)
" implementation: Visual Works "
OS.Stderr 
  nextPutAll: x asString;
  nextPutAll: ' is negative';
  nextPut: Character cr.
System.err.printf("%d is negative", x);