Write

From Free Pascal wiki
Revision as of 08:34, 5 September 2017 by Djzepi (talk | contribs)
Jump to navigationJump to search

Deutsch (de) English (en) español (es) русский (ru)

Write is a keyword which indicates that some data must be written on the screen (by default) or to a file. For example:

var
  a, b: Integer;
begin
  a := 42;
  b := 23;
  write('a=', a, ' and b=', b);
end.

This prints on screen: a=42 and b=23

Parameters in the Write procedure must be separated by a comma (',').

The colon (':') is used to formatting output: write(x:num); Num indicates the total positions to be used. If the value contained in the variable x needs more digits, num is ignored. Writing reals formatted write(x:num1:num2); X is a real variable, num1 is the total amount of digits to use (including sign and period) and num2 is the number of digits after the period.


WriteLn behaves just like Write, except it leaves (a) newline character(s) after the text (End of Line).