SlideShare a Scribd company logo
5
Most read
7
Most read
24
Most read
Pascal Programming Language
CSE 337
Concepts of Programming Languages
Qassim University
College of Computer – IT department
Ms.Sadaf Ambreen Abbasi.
Reham AL blihed
Muna AL rajhi
Outline
• About Pascal (programming language)
• General Program Skeleton
• Pascal Hello World Example
• Decision Making In Pascal
• Supprogram In Pascal
• Loop In Pascal
• Array
About Pascal (programming language)
•Pascal
- is a historically influential imperative and procedural programming
language.
- designed in 1968–1969 and published in 1970 by Niklaus Wirth as a
small and efficient language intended to encourage good
programming practices using structured programming and data
structuring.
General Program Skeleton
• The basic syntax for a Pascal program:
Pascal Hello World Example
• The first line of the program program HelloWorld; indicates the name
of the program.
• begin and end statements are the main program block.
• The end statement indicating the end of the main program is
followed by a full stop (.)
• The lines within (*...*) will be ignored by the compiler and it has
been put to add a comment in the program.
• he statement writeln('Hello, World!'); function in Pascal used to
display Message on the screen.
Decision Making In Pascal
• Decision Making In Pascal :
- if - then statement
- if-then-else Statement
- Case Statement
- Case Else Statement
Decision Making - if - then statement
• Syntax for if-then statement is:
If the Boolean expression evaluates to true, the statement executes.
Otherwise, it is skipped.
if BooleanExpression then
StatementIfTrue;
Decision Making - if – then-else statement
• Syntax for the if-then-else statement is:
If the Boolean expression evaluates to FALSE, the statement following the else
will be performed.
if BooleanExpression then
StatementIfTrue
else
StatementIfFalse;
Decision Making - case - of statement
• The syntax of the case statement is:
Similar to if statement
Easier to read and understand
Does not accept String variables
case (expression) of
L1 : S1;
...
Ln : Sn;
end;
Decision Making - case statement
• Example case – of statement :
Decision Making - case -else statement
• The syntax for the case-else statement is:
• It is similar to the if-then-else statements
• Easier to read and understand
• Does not accept String variables
case (expression) of
L1 : S1;
L2 : S2;
...
Ln : Sn;
else
Sm;
end;
Decision Making - case -else statement
• Example :
SUPPROGRAM IN PASCAL
A subprogram is a program unit/module that performs a particular
task.
Pascal provides two kinds of subprograms:
• Functions: these subprograms return a single value.
• Procedures: these subprograms do not return a value directly
SUPPROGRAM IN PASCAL FUNCTION
• The general form of a function definition is as follows:
function name(argument(s): type1; argument(s): type2; ...): function_type;
local declarations;
begin
...
< statements >
...
name:= expression;
end;
FUNCTION
• Example :
PROCEDURES
• Used to separate code into section.
• Can be called by the main program, function or other procedures.
• Must be created above the main program.
• The general form of a procedure definition is as follows:
procedure name(argument(s): type1, argument(s): type 2, ... );
< local declarations >
begin
< procedure body >
end;
PROCEDURES
• Example: procedure without parameters
PROCEDURES
• PROCEDURES Pass by value:
This method copies the actual value of an argument into the formal parameter of
the subprogram. In this case, changes made to the parameter inside the
subprogram have no effect on the argument.
• That means MyNumber and X have two different locations in memory.
PROCEDURES
• PROCEDURES Calling by reference
• If we add the var keyword to the declaration of DoSomething's x parameter, things will
be different now:
This time MyNumber's value will be changed according to x, which means they are sharing the same memory location.
LOOP IN PASCAL
• LOOP IN PASCAL
- WHILE - DO
- FOR-DO
- REPEAT UNTIL
WHILE - DO LOOP
• The syntax of a while-do loop is:
Where condition is a Boolean or relational expression, whose value would be
true or false and the computer will do something is a simple statement or group
of statements within begin ... end block.
While <condition> do
begin
The computer will do something;
end;
FOR-DO LOOP
• The syntax of for-do loop as follows:
for low to high do
begin
The computer will do something;
end;
for high downto low do
begin
The computer will do something;
end;
REPEAT UNTIL LOOP
• Unlike for and while loops, which test the loop condition at the top of
the loop, the repeat ... until loop in Pascal checks its condition at the
bottom of the loop.
• The syntax of the repeat until as follows:
repeat
The computer will do something;
until<condition>;
ARRAY IN PASCAL
• The syntax for the Array as follows:
Example:
var
array-name : array[range] of element-type;

More Related Content

What's hot (20)

PPT
Algorithmic Notations
Muhammad Muzammal
 
PDF
Pascal tutorial
hidden__
 
PDF
pdf c programming language.pdf
VineethReddy560178
 
PPTX
Introduction to programming
Neeru Mittal
 
PPTX
Object Oriented Programming Languages
Mannu Khani
 
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
PPTX
Compilers
Bense Tony
 
PPS
Vb6.0 Introduction
Tennyson
 
PPT
Pascal Programming Session 1
Ashesh R
 
PPTX
Object Oriented Programming
Iqra khalil
 
PDF
Lecture 01 introduction to compiler
Iffat Anjum
 
PPTX
File Management in C
Paurav Shah
 
PPTX
Introduction to JAVA
ParminderKundu
 
PPTX
C# 101: Intro to Programming with C#
Hawkman Academy
 
PPTX
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
PPT
Control structure C++
Anil Kumar
 
PPT
Java Presentation
pm2214
 
PPTX
Control Statements in Java
Niloy Saha
 
PPT
User defined functions in C programmig
Appili Vamsi Krishna
 
Algorithmic Notations
Muhammad Muzammal
 
Pascal tutorial
hidden__
 
pdf c programming language.pdf
VineethReddy560178
 
Introduction to programming
Neeru Mittal
 
Object Oriented Programming Languages
Mannu Khani
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Compilers
Bense Tony
 
Vb6.0 Introduction
Tennyson
 
Pascal Programming Session 1
Ashesh R
 
Object Oriented Programming
Iqra khalil
 
Lecture 01 introduction to compiler
Iffat Anjum
 
File Management in C
Paurav Shah
 
Introduction to JAVA
ParminderKundu
 
C# 101: Intro to Programming with C#
Hawkman Academy
 
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Control structure C++
Anil Kumar
 
Java Presentation
pm2214
 
Control Statements in Java
Niloy Saha
 
User defined functions in C programmig
Appili Vamsi Krishna
 

Viewers also liked (20)

PDF
Pascal programming lecture notes
Alejandro Domínguez Torres
 
PDF
Pascal programming language
Mahesh Kodituwakku
 
PDF
GCE O/L ICT
Mahesh Kodituwakku
 
PDF
ICT Lessons in Sinhala
Mahesh Kodituwakku
 
PDF
G.C.E O/L ICT Short Notes Grade-11
Mahesh Kodituwakku
 
PDF
Pascal programming language
Verónica Meo Laos
 
PDF
ICT G.C.E O/L 2016 Model Paper
Mahesh Kodituwakku
 
PPT
Hello world pascal tutorial
Serghei Urban
 
PPSX
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
PDF
Control statements
Kanwalpreet Kaur
 
PDF
G.C.E. A/L ICT
Mahesh Kodituwakku
 
PPTX
Files c4
Omar Al-Sabek
 
PDF
Sets c1
Omar Al-Sabek
 
PPTX
Files c3
Omar Al-Sabek
 
PDF
Records c2
Omar Al-Sabek
 
PPTX
How to do a good presentation in public
edlok
 
PPTX
Pascal
AAPerevalova
 
DOCX
Program pascal menghitung ipk
Arjanggi Nv
 
PDF
Programming paradigms c1
Omar Al-Sabek
 
PDF
Function procedure c6 c7
Omar Al-Sabek
 
Pascal programming lecture notes
Alejandro Domínguez Torres
 
Pascal programming language
Mahesh Kodituwakku
 
GCE O/L ICT
Mahesh Kodituwakku
 
ICT Lessons in Sinhala
Mahesh Kodituwakku
 
G.C.E O/L ICT Short Notes Grade-11
Mahesh Kodituwakku
 
Pascal programming language
Verónica Meo Laos
 
ICT G.C.E O/L 2016 Model Paper
Mahesh Kodituwakku
 
Hello world pascal tutorial
Serghei Urban
 
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
Control statements
Kanwalpreet Kaur
 
G.C.E. A/L ICT
Mahesh Kodituwakku
 
Files c4
Omar Al-Sabek
 
Sets c1
Omar Al-Sabek
 
Files c3
Omar Al-Sabek
 
Records c2
Omar Al-Sabek
 
How to do a good presentation in public
edlok
 
Pascal
AAPerevalova
 
Program pascal menghitung ipk
Arjanggi Nv
 
Programming paradigms c1
Omar Al-Sabek
 
Function procedure c6 c7
Omar Al-Sabek
 
Ad

Similar to Pascal Programming Language (20)

PPTX
banaz hilmy.pptx
BaNaz8
 
PDF
Apple IIgs Programming (K Fest)
Polymorph
 
PDF
Pascal for beginers tute
Anutthara Senanayake
 
PPT
ch8.ppt
FakhriAlamKhan1
 
PDF
Control structures c2 c3
Omar Al-Sabek
 
PPTX
PL/SQL Introduction
Phanindra Oruganti
 
PPTX
Basic Computer Programming
Allen de Castro
 
PPT
Chapter 5( programming) answer
smkengkilili2011
 
PDF
8 statement-level control structure
jigeno
 
PPT
Problem Solving Techniques
Ashesh R
 
PPTX
CONTROL STRUCTURE IN VB
classall
 
PPTX
Problem Solving PPT Slides Grade 10- 11students
chamm5
 
PDF
Evaluation and analysis of ALGOL, PASCAL and ADA
Dilanka Dias
 
PPTX
Fundamentals of programming final
Ricky Recto
 
PPT
Cobol basics 19-6-2010
SivaprasanthRentala1975
 
PPTX
Turbo pascal
Vien Rivera
 
PPTX
Looping and switch cases
MeoRamos
 
PPTX
Introduction to Programming and QBasic Tutorial
nhomz
 
PPTX
Fundamentals of programming final santos
Abie Santos
 
PPTX
Introduction to programming
Gwyneth Calica
 
banaz hilmy.pptx
BaNaz8
 
Apple IIgs Programming (K Fest)
Polymorph
 
Pascal for beginers tute
Anutthara Senanayake
 
Control structures c2 c3
Omar Al-Sabek
 
PL/SQL Introduction
Phanindra Oruganti
 
Basic Computer Programming
Allen de Castro
 
Chapter 5( programming) answer
smkengkilili2011
 
8 statement-level control structure
jigeno
 
Problem Solving Techniques
Ashesh R
 
CONTROL STRUCTURE IN VB
classall
 
Problem Solving PPT Slides Grade 10- 11students
chamm5
 
Evaluation and analysis of ALGOL, PASCAL and ADA
Dilanka Dias
 
Fundamentals of programming final
Ricky Recto
 
Cobol basics 19-6-2010
SivaprasanthRentala1975
 
Turbo pascal
Vien Rivera
 
Looping and switch cases
MeoRamos
 
Introduction to Programming and QBasic Tutorial
nhomz
 
Fundamentals of programming final santos
Abie Santos
 
Introduction to programming
Gwyneth Calica
 
Ad

Recently uploaded (20)

PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Python basic programing language for automation
DanialHabibi2
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 

Pascal Programming Language

  • 1. Pascal Programming Language CSE 337 Concepts of Programming Languages Qassim University College of Computer – IT department Ms.Sadaf Ambreen Abbasi. Reham AL blihed Muna AL rajhi
  • 2. Outline • About Pascal (programming language) • General Program Skeleton • Pascal Hello World Example • Decision Making In Pascal • Supprogram In Pascal • Loop In Pascal • Array
  • 3. About Pascal (programming language) •Pascal - is a historically influential imperative and procedural programming language. - designed in 1968–1969 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.
  • 4. General Program Skeleton • The basic syntax for a Pascal program:
  • 5. Pascal Hello World Example • The first line of the program program HelloWorld; indicates the name of the program. • begin and end statements are the main program block. • The end statement indicating the end of the main program is followed by a full stop (.) • The lines within (*...*) will be ignored by the compiler and it has been put to add a comment in the program. • he statement writeln('Hello, World!'); function in Pascal used to display Message on the screen.
  • 6. Decision Making In Pascal • Decision Making In Pascal : - if - then statement - if-then-else Statement - Case Statement - Case Else Statement
  • 7. Decision Making - if - then statement • Syntax for if-then statement is: If the Boolean expression evaluates to true, the statement executes. Otherwise, it is skipped. if BooleanExpression then StatementIfTrue;
  • 8. Decision Making - if – then-else statement • Syntax for the if-then-else statement is: If the Boolean expression evaluates to FALSE, the statement following the else will be performed. if BooleanExpression then StatementIfTrue else StatementIfFalse;
  • 9. Decision Making - case - of statement • The syntax of the case statement is: Similar to if statement Easier to read and understand Does not accept String variables case (expression) of L1 : S1; ... Ln : Sn; end;
  • 10. Decision Making - case statement • Example case – of statement :
  • 11. Decision Making - case -else statement • The syntax for the case-else statement is: • It is similar to the if-then-else statements • Easier to read and understand • Does not accept String variables case (expression) of L1 : S1; L2 : S2; ... Ln : Sn; else Sm; end;
  • 12. Decision Making - case -else statement • Example :
  • 13. SUPPROGRAM IN PASCAL A subprogram is a program unit/module that performs a particular task. Pascal provides two kinds of subprograms: • Functions: these subprograms return a single value. • Procedures: these subprograms do not return a value directly
  • 14. SUPPROGRAM IN PASCAL FUNCTION • The general form of a function definition is as follows: function name(argument(s): type1; argument(s): type2; ...): function_type; local declarations; begin ... < statements > ... name:= expression; end;
  • 16. PROCEDURES • Used to separate code into section. • Can be called by the main program, function or other procedures. • Must be created above the main program. • The general form of a procedure definition is as follows: procedure name(argument(s): type1, argument(s): type 2, ... ); < local declarations > begin < procedure body > end;
  • 17. PROCEDURES • Example: procedure without parameters
  • 18. PROCEDURES • PROCEDURES Pass by value: This method copies the actual value of an argument into the formal parameter of the subprogram. In this case, changes made to the parameter inside the subprogram have no effect on the argument. • That means MyNumber and X have two different locations in memory.
  • 19. PROCEDURES • PROCEDURES Calling by reference • If we add the var keyword to the declaration of DoSomething's x parameter, things will be different now: This time MyNumber's value will be changed according to x, which means they are sharing the same memory location.
  • 20. LOOP IN PASCAL • LOOP IN PASCAL - WHILE - DO - FOR-DO - REPEAT UNTIL
  • 21. WHILE - DO LOOP • The syntax of a while-do loop is: Where condition is a Boolean or relational expression, whose value would be true or false and the computer will do something is a simple statement or group of statements within begin ... end block. While <condition> do begin The computer will do something; end;
  • 22. FOR-DO LOOP • The syntax of for-do loop as follows: for low to high do begin The computer will do something; end; for high downto low do begin The computer will do something; end;
  • 23. REPEAT UNTIL LOOP • Unlike for and while loops, which test the loop condition at the top of the loop, the repeat ... until loop in Pascal checks its condition at the bottom of the loop. • The syntax of the repeat until as follows: repeat The computer will do something; until<condition>;
  • 24. ARRAY IN PASCAL • The syntax for the Array as follows: Example: var array-name : array[range] of element-type;