Logo

Programming-Idioms

  • C#
  • Obj-c

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").

@import Foundation;
NSLog(@"%d is negative",x)

If the NSLog extra information like timestamp etc. is harmful, the plain-C solution with stderr works too
import System;
Console.Error.WriteLine($"{x} is negative");
with Ada.Text_IO;
use Ada.Text_IO;
Put_Line (Standard_Error, Integer'Image (X) & " is negative");

New implementation...
< >
programming-idioms.org