Pascal - Tutorialspoint
Pascal
i
Pascal
About the Tutorial
Pascal is a procedural programming language, designed in 1968 and published in
1970 by Niklaus Wirth and named in honor of the French mathematician and
philosopher Blaise Pascal. Pascal runs on a variety of platforms, such as Windows,
Mac OS, and various versions of UNIX/Linux.
This tutorial will give you great understanding of Pascal to proceed with Delphi
and other related frameworks etc.
Audience
This tutorial is designed for Software Professionals who are willing to learn Pascal
Programming Language in simple and easy steps. This tutorial will give you great
understanding on Pascal Programming concepts, and after completing this tutorial,
you will be at intermediate level of expertise from where you can take yourself to
higher level of expertise.
Prerequisites
Before proceeding with this tutorial you should have a basic understanding of
software basic concepts like what is source code, compiler, text editor, and
execution of programs, etc. If you already have understanding on any other
computer programming language, then it will be an added advantage to proceed.
Copyright & Disclaimer
? Copyright 2015 by Tutorials Point (I) Pvt. Ltd.
All the content and graphics published in this e-book are the property of Tutorials
Point (I) Pvt. Ltd. The user of this e-book can retain a copy for future reference
but commercial use of this data is not allowed. Distribution or republishing any
content or a part of the content of this e-book in any manner is also not allowed
without written consent of the publisher.
We strive to update the contents of our website and tutorials as timely and as
precisely as possible, however, the contents may contain inaccuracies or errors.
Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy,
timeliness or completeness of our website or its contents including this tutorial. If
you discover any errors on our website or in this tutorial, please notify us at
contact@
ii
Pascal
Table of Contents
About the Tutorial ................................................................................................................................... ii
Audience ................................................................................................................................................. ii
Prerequisites ........................................................................................................................................... ii
Copyright & Disclaimer............................................................................................................................ ii
Table of Contents ..................................................................................................................................... i
1.
OVERVIEW........................................................................................................................... 1
Features of the Pascal Language ............................................................................................................. 1
Facts about Pascal ................................................................................................................................... 1
Why to use Pascal?.................................................................................................................................. 2
2.
ENVIRONMENT SET UP ........................................................................................................ 3
Installing Free Pascal on Linux ................................................................................................................. 3
Installing Free Pascal on Mac .................................................................................................................. 4
Installing Free Pascal on Windows .......................................................................................................... 4
Text Editor............................................................................................................................................... 4
3.
PROGRAM STRUCTURE........................................................................................................ 5
Pascal Program Structure ........................................................................................................................ 5
Pascal Hello World Example .................................................................................................................... 6
Compile and Execute Pascal Program ...................................................................................................... 7
4.
BASIC SYNTAX ...................................................................................................................... 9
Variable................................................................................................................................................... 9
Functions/Procedures ............................................................................................................................. 9
Comments ............................................................................................................................................... 9
Case Sensitivity ..................................................................................................................................... 10
Pascal Statements ................................................................................................................................. 10
i
Pascal
Reserved Words in Pascal ..................................................................................................................... 10
Character Set and Identifiers in Pascal .................................................................................................. 10
5.
DATA TYPES ....................................................................................................................... 12
Pascal Data Types .................................................................................................................................. 12
Type Declarations.................................................................................................................................. 12
Integer Types ........................................................................................................................................ 13
Constants .............................................................................................................................................. 13
Enumerated types ................................................................................................................................. 14
Subrange Types ..................................................................................................................................... 14
6.
VARIABLE TYPES ................................................................................................................ 16
Basic Variables in Pascal ........................................................................................................................ 16
Variable Declaration in Pascal ............................................................................................................... 16
Variable Initialization in Pascal .............................................................................................................. 18
Enumerated Variables ........................................................................................................................... 19
Subrange Variables ............................................................................................................................... 20
7.
CONSTANTS ....................................................................................................................... 21
Declaring Constants .............................................................................................................................. 21
8.
OPERATORS ....................................................................................................................... 23
Arithmetic Operators ............................................................................................................................ 23
Relational Operators ............................................................................................................................. 24
Boolean Operators ................................................................................................................................ 26
Bit Operators......................................................................................................................................... 28
Operators Precedence in Pascal ............................................................................................................ 31
9.
DECISION MAKING............................................................................................................. 33
if-then Statement .................................................................................................................................. 34
Syntax ................................................................................................................................................... 34
ii
Pascal
Flow Diagram ........................................................................................................................................ 35
Example ................................................................................................................................................ 35
if-then-else Statement .......................................................................................................................... 36
Syntax ................................................................................................................................................... 36
Flow Diagram ........................................................................................................................................ 36
Example ................................................................................................................................................ 37
The if-then-else if-then-else Statement ................................................................................................. 37
Syntax ................................................................................................................................................... 38
Example ................................................................................................................................................ 38
Nested if-then Statements .................................................................................................................... 39
Syntax ................................................................................................................................................... 39
Example ................................................................................................................................................ 40
Case Statement ..................................................................................................................................... 41
Syntax ................................................................................................................................................... 41
Flow Diagram ........................................................................................................................................ 42
Example ................................................................................................................................................ 42
Case Else Statement .............................................................................................................................. 43
Syntax ................................................................................................................................................... 43
Flow Diagram ........................................................................................................................................ 44
Example ................................................................................................................................................ 44
Nested Case Statements ....................................................................................................................... 45
Syntax ................................................................................................................................................... 45
Example ................................................................................................................................................ 45
10. LOOPS ............................................................................................................................... 47
While-do Loops ..................................................................................................................................... 48
Syntax ................................................................................................................................................... 48
Flow Diagram ........................................................................................................................................ 49
iii
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- pascal to kg
- pascal triangle
- binomial pascal triangle calculator
- pascal s triangle patterns
- pascal s triangle math
- pascal s triangle calculator
- pascal s triangle binomial expansion practice
- pascal units kg
- binomial theorem pascal s triangle worksheet
- pascal s triangle binomial expansion
- pascal s triangle factoring
- expand binomial using pascal s triangle