This is by no means a comprehensive command index, but its' purpose is as a central reference point for the commands used in programs throughout the primer. Most Pascal compilers will have more thorough command references in their help menus.
append
Opens a specified file in append mode - positions the file pointer after any existing records and prepares to write to the file
Append (fileid);
assign
Assigns a physical file location and file name with a given file variable
Assign (fileid, PhysicalFileLocation)
begin..end
The begin...end block delimits a sequence of commands to be executed together. In the main program block of commands, the block is terminated with a period after the last end.
case
The case..of construct is used to choose a course of action where a number of alternative possibilities exist.
Case expression of
value1 : command;
value2 : command;
......
else : command
end;
close
Closes the specified fileid
Close (flieid);
const
Declares a constant object and assigns the value of that object to the object name
Const object_name = value;
copy
Returns a substring of a parameter string
Copy (string, start_pos, length);
delete
Deletes a substring of a parameter string
Delete (string, start_pos, length);
eof
Returns true if the specified file pointer points to the end of that file
Eof (fileid)
for
For counter := start to finish do command; or
For counter := finish downto start do command;
In the first implementation, repeats command finish-start times, incrementing start by one on each repetition.
if
If expression then command1 else command2;
If expression evaluates to true, executes command1, else executes command2. Command1 or Command2 may be a single command or a block of commands.
length
Returns the length of the string passed to it as parameter
Length (string);
pos
Returns the position of the first instance of a character or string in another string
Pos (findstring, bigstring);
read
Reads a line of input from the specified input device into the specified variable and does not move to the next line. If the input device is not specified, input is read from the default input device, typically the computer screen.
Read (fileid, variable);
readln
Same as read, except moves throws to a new line
Readln (fileid, variable);
repeat
Repeats a set of commands until a condition evaluates to be true.
Repeat command until (condition);
reset
Opens a file for input and moves the file pointer to the top of the file.
Reset (fileid);
rewrite
Opens a file for output, and moves the file pointer to the top of that file, overwriting any data that may already exist in the file.
Rewrite (fileid);
sqrt
Returns the square root of the variable passed to it as parameter
sqrt (number);
type
Defines a variable type and its characteristics. The variable type may be a simple datatype, e.g. an integer or a composite data type, e.g. a record.
Type typename = datatype;
upcase
Converts the character passed to it as parameter to upper case.
Upcase (character);
var
Declares a variable and its characteristics
Var var_name : datatype;
while
Repeats a command or command block while condition evaluates to true. If the condition does not evaluate to true when it is first tested, the command is never executed.
While (condition) do command;
with
Allows subfields of a record to be referenced without typing out their full name. The record variable is specified in the with command, and subfields of that record can then be referenced without specifiying the record variable.
With record_var do command;
write
Writes output to fileid - if fileid is blank, writes to the default output device, usually the computer screen. Does not throw to a new line once the output is written to the output device.
Write (fileid, output);
writeln
Same as writeln except does not throw to a new line.
Writeln (fileid, output);