This page explains a basic Pascal instruction. If you want to see how to make your own instructions, see Procedures and Functions.
This article is part of the Getting Started series |
|
The WRITE and WRITELN instructions print text or variables on the screen. For example: write ('Test'); prints on the screen "Test". Don't forget to put the apostrophes (') before and after the text to be shown. The apostrophes will not be displayed.
The difference between WRITE and WRITELN is that WRITELN prints the text on the screen then places the cursor on the first place of the next row on the screen.
WRITE and WRITELN can also show the contents of the variables. For example: write ('The variable "a" is equal to ',a); prints on the screen "The variable "a" is equal to " then prints the contents of the variable.i Examples
- writeln ('Hello World!'); prints "Hello World!" on the screen and moves the cursor on the next row.
- write ('a=',a); prints "a=" on the screen and then prints the contents of the a variable.
- write; prints nothing..!.
('Test')