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.
- any object type, and the result of a nil-safe call to
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 ofSystem.Console.Write(x)
, andwriteLn(x)
is the equivalent ofSystem.Console.WriteLine(c.ToString)
. - On Java,
write(x)
is the equivalent ofsystem.out.print(x)
, andwriteLn(x)
is the equivalent ofsystem.out.println(x.toString)
. - On Cocoa,
write(x)
is the equivalent ofprintf('%?', x)
, andwriteLn(x)
is the equivalent ofprintf('%?\n', x)
, with ? being the appropriate placeholder for the given type.