09.10.2014 Views

download pascal tutorial (pdf - Tutorials Point

download pascal tutorial (pdf - Tutorials Point

download pascal tutorial (pdf - Tutorials Point

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER<br />

4<br />

Basic Syntax<br />

You have seen a basic structure of Pascal program, so it will be easy to understand other<br />

basic building blocks of the Pascal programming language.<br />

This section shows the basic syntax of Pascal program.<br />

Variables<br />

A<br />

variable definition is put in a block beginning with a var keyword, followed by<br />

definitions of the variables as follows:<br />

var<br />

A_Variable, B_Variable ... : Variable_Type;<br />

Pascal variables are declared outside the code-body of the function which means they are<br />

not declared within the begin and end pairs, but they are declared after the definition of<br />

the procedure/function and before the begin keyword. For global variables, they are<br />

defined after the program header.<br />

Functions/Procedures<br />

In Pascal, a procedure is set of instructions to be executed, with no return value and a<br />

function is a procedure with a return value. The definition of function/procedures will be<br />

as follows:<br />

Function Func_Name(params...) : Return_Value;<br />

Procedure Proc_Name(params...);<br />

Comments<br />

TUTORIALS POINT<br />

Simply Easy Learning Page 9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!