SlideShare a Scribd company logo
1 of 24
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

Generation of computer languages
Generation of computer languagesGeneration of computer languages
Generation of computer languages
kitturashmikittu
 

What's hot (20)

Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
Instruction format
Instruction formatInstruction format
Instruction format
 
Pascal programming lecture notes
Pascal programming lecture notesPascal programming lecture notes
Pascal programming lecture notes
 
Introduction to computing
Introduction to computingIntroduction to computing
Introduction to computing
 
Pascal programming language
Pascal programming languagePascal programming language
Pascal programming language
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Programming Fundamental Slide No.1
Programming Fundamental Slide No.1
 
Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language
 
Generation of computer languages
Generation of computer languagesGeneration of computer languages
Generation of computer languages
 
C basics
C   basicsC   basics
C basics
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
 
pseudo code basics
pseudo code basicspseudo code basics
pseudo code basics
 
Notes of c programming 1st unit BCA I SEM
Notes of c programming  1st unit BCA I SEMNotes of c programming  1st unit BCA I SEM
Notes of c programming 1st unit BCA I SEM
 
Theory of programming
Theory of programmingTheory of programming
Theory of programming
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
Formatting A Document in Microsoft Word
Formatting A Document in Microsoft WordFormatting A Document in Microsoft Word
Formatting A Document in Microsoft Word
 
Types of Programming Errors
Types of Programming ErrorsTypes of Programming Errors
Types of Programming Errors
 

Viewers also liked

Hello world pascal tutorial
Hello world pascal tutorialHello world pascal tutorial
Hello world pascal tutorial
Serghei Urban
 
How to do a good presentation in public
How to do a good presentation in publicHow to do a good presentation in public
How to do a good presentation in public
edlok
 
Jedi course notes intro to programming 1
Jedi course notes intro to programming 1Jedi course notes intro to programming 1
Jedi course notes intro to programming 1
aehj02
 

Viewers also liked (20)

Pascal programming language
Pascal programming languagePascal programming language
Pascal programming language
 
GCE O/L ICT
GCE O/L ICT GCE O/L ICT
GCE O/L ICT
 
Pascal tutorial
Pascal tutorialPascal tutorial
Pascal tutorial
 
ICT Lessons in Sinhala
ICT Lessons in SinhalaICT Lessons in Sinhala
ICT Lessons in Sinhala
 
G.C.E O/L ICT Short Notes Grade-11
G.C.E O/L ICT Short Notes Grade-11G.C.E O/L ICT Short Notes Grade-11
G.C.E O/L ICT Short Notes Grade-11
 
ICT G.C.E O/L 2016 Model Paper
ICT G.C.E O/L 2016 Model PaperICT G.C.E O/L 2016 Model Paper
ICT G.C.E O/L 2016 Model Paper
 
Hello world pascal tutorial
Hello world pascal tutorialHello world pascal tutorial
Hello world pascal tutorial
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Control statements
Control statementsControl statements
Control statements
 
G.C.E. A/L ICT
G.C.E. A/L ICTG.C.E. A/L ICT
G.C.E. A/L ICT
 
Files c4
Files c4Files c4
Files c4
 
Sets c1
Sets c1Sets c1
Sets c1
 
Files c3
Files c3Files c3
Files c3
 
Records c2
Records c2Records c2
Records c2
 
How to do a good presentation in public
How to do a good presentation in publicHow to do a good presentation in public
How to do a good presentation in public
 
Pascal
PascalPascal
Pascal
 
Program pascal menghitung ipk
Program pascal menghitung ipkProgram pascal menghitung ipk
Program pascal menghitung ipk
 
Programming paradigms c1
Programming paradigms c1Programming paradigms c1
Programming paradigms c1
 
Function procedure c6 c7
Function procedure  c6 c7Function procedure  c6 c7
Function procedure c6 c7
 
Jedi course notes intro to programming 1
Jedi course notes intro to programming 1Jedi course notes intro to programming 1
Jedi course notes intro to programming 1
 

Similar to Pascal Programming Language

Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
MeoRamos
 
9780538745840 ppt ch02
9780538745840 ppt ch029780538745840 ppt ch02
9780538745840 ppt ch02
Terry Yoast
 
advancedzplmacroprogramming_081820.pptx
advancedzplmacroprogramming_081820.pptxadvancedzplmacroprogramming_081820.pptx
advancedzplmacroprogramming_081820.pptx
ssuser6a1dbf
 
Switch case and looping statement
Switch case and looping statementSwitch case and looping statement
Switch case and looping statement
_jenica
 

Similar to Pascal Programming Language (20)

banaz hilmy.pptx
banaz hilmy.pptxbanaz hilmy.pptx
banaz hilmy.pptx
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
 
Survelaine murillo ppt
Survelaine murillo pptSurvelaine murillo ppt
Survelaine murillo ppt
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
 
Can programming be liberated from the von neumann style?
Can programming be liberated from the von neumann style?Can programming be liberated from the von neumann style?
Can programming be liberated from the von neumann style?
 
Lesson 1 of c programming algorithms and flowcharts.pptx
Lesson 1 of c programming algorithms and flowcharts.pptxLesson 1 of c programming algorithms and flowcharts.pptx
Lesson 1 of c programming algorithms and flowcharts.pptx
 
Final requirement
Final requirementFinal requirement
Final requirement
 
PARADIGM IT.pptx
PARADIGM IT.pptxPARADIGM IT.pptx
PARADIGM IT.pptx
 
JavaScript: Core Part
JavaScript: Core PartJavaScript: Core Part
JavaScript: Core Part
 
Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)
 
Programming
ProgrammingProgramming
Programming
 
Subroutines
SubroutinesSubroutines
Subroutines
 
Functional Programming in Java
Functional Programming in JavaFunctional Programming in Java
Functional Programming in Java
 
9780538745840 ppt ch02
9780538745840 ppt ch029780538745840 ppt ch02
9780538745840 ppt ch02
 
Apple IIgs Programming (K Fest)
Apple IIgs Programming (K Fest)Apple IIgs Programming (K Fest)
Apple IIgs Programming (K Fest)
 
advancedzplmacroprogramming_081820.pptx
advancedzplmacroprogramming_081820.pptxadvancedzplmacroprogramming_081820.pptx
advancedzplmacroprogramming_081820.pptx
 
final pl paper
final pl paperfinal pl paper
final pl paper
 
programming.ppt
programming.pptprogramming.ppt
programming.ppt
 
ORACLE PL/SQL
ORACLE PL/SQLORACLE PL/SQL
ORACLE PL/SQL
 
Switch case and looping statement
Switch case and looping statementSwitch case and looping statement
Switch case and looping statement
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

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;