write()/writeLn()

The Pascal-classic write() and writeLn() system functions are available for printing out content to the console. Both functions take a single parameter and behave the same, with writeLn() also emitting a platform-specific line-feed after printing the passed value.

  • On .NET, any type can be passed as argument, and the result of the object's .ToString() method will be printed.
  • On Java, any type can be passed as argument, and the result of the object's .toString() method will be printed.
  • On Cocoa, the following parameter types can be passed:
    • any object type, and the result of a nil-safe call to .description.UTF8String will be printed,
    • ^AnsiChar types,
    • simple types, such as Integers, Floats, Chars.

The writeLn() function can also be called without any parameter, in which case only a line-feed will be emitted.

Platform Equivalents

  • On .NET, write(x) is the equivalent of System.Console.Write(x), and writeLn(x) is the equivalent of System.Console.WriteLine(c.ToString).
  • On Java, write(x) is the equivalent of system.out.print(x), and writeLn(x) is the equivalent of system.out.println(x.toString).
  • On Cocoa, write(x) is the equivalent of printf('%?', x), and writeLn(x) is the equivalent of printf('%?\n', x), with ? being the appropriate placeholder for the given type.

See Also