Logo

Programming-Idioms

History of Idiom 59 > diff from v19 to v20

Edit summary for version 20 by :

Version 19

2015-09-04, 17:24:44

Version 20

2015-10-29, 14:05:15

Idiom #59 Write to standard error stream

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

Idiom #59 Write to standard error stream

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

Imports
import System.IO (hPutStrLn, stderr)
Imports
import System.IO (hPutStrLn, stderr)
Code
hPutStrLn stderr (show (x) ++ " is negative")
Code
hPutStrLn stderr (show (x) ++ " is negative")
Imports
#include <stdio.h>
Imports
#include <stdio.h>
Code
fprintf(stderr,"%d is negative\n",x);
Code
fprintf(stderr,"%d is negative\n",x);
Code
System.err.format("%d is negative\n",x);
Code
System.err.format("%d is negative\n",x);
Demo URL
https://ideone.com/aiFVno
Demo URL
https://ideone.com/aiFVno
Imports
import "os"
Imports
import "os"
Code
fmt.Fprintln(os.Stderr, x, "is negative")
Code
fmt.Fprintln(os.Stderr, x, "is negative")
Demo URL
https://play.golang.org/p/6x6amJrySS
Demo URL
https://play.golang.org/p/6x6amJrySS