Basic Pascal Syntax
Basic Pascal Syntax
What is Syntax?
Program program_name;
USES CRT;
4. Declaring Variables
Locations in memory that cannot be changed during program are called constants e.g pi.
e.g.
Begin
STATEMENTS TO EXECUTE
End.
WRITELN(‘TEXT TO BE DISPLAYED’);
WRITELN(‘TEXT TO BE DISPLAYED’, VARIABLE);
WRITE(‘TEXT TO BE DISPLAYED’);
WRITELN will place the cursor on a new line after displaying the text, WRITE will not. Cursor
will be on the same line as text.
7. Input Statement
Use input statement to collect data from a user (keyboard) and store it in a variable.
READLN(VARIABLE);
Eg.
READLN(NUM1);
8. Assignment Statements
Assignment statements are used to store data in a variable (memory location)
VARIABLE_NAME := DATA ;
EG.
NUM1 := 20;