SlideShare a Scribd company logo
Machine Control flow
Control flow
By
Ms. V.VENNILA, MCA.,M.Phil.,
Assistant Professor,
Bon Secours College for Women, Thanjavur.
Control flow
In computer science, control flow (or flow of control) is the order in which
individual statements, instructions or function calls of
an imperativeprogram are executed or evaluated. The emphasis on explicit
control flow distinguishes an imperative programming language from
a declarative programming language.
Within an imperative programming language, a control flow statement is a
statement that results in a choice being made as to which of two or more
paths to follow. For non-strict functional languages, functions and language
constructs exist to achieve the same result, but they are usually not termed
control flow statements.
A set of statements is in turn generally structured as a block, which in
addition to grouping, also defines a lexical scope.
Categories
The kinds of control flow statements supported by different
languages vary, but can be categorized by their effect:
Continuation at a different statement
(unconditional branch or jump)
Executing a set of statements only if some condition is met
(choice - i.e., conditional branch)
Executing a set of statements zero or more times, until
some condition is met (i.e., loop - the same as conditional
branch)
Executing a set of distant statements, after which the flow
of control usually returns (subroutines, coroutines,
and continuations)
Stopping the program, preventing any further execution
(unconditional halt)
Minimal structured control flow
• In May 1966, Böhm and Jacopini published an article
in Communications of the ACM which showed that any program
with gotos could be transformed into a goto-free form involving
only choice (IF THEN ELSE) and loops (WHILE condition DO
xxx), possibly with duplicated code and/or the addition of
Boolean variables (true/false flags). Later authors showed that
choice can be replaced by loops (and yet more Boolean
variables).
• That such minimalism is possible does not mean that it is
necessarily desirable; after all, computers theoretically need
only one machine instruction(subtract one number from another
and branch if the result is negative), but practical computers
have dozens or even hundreds of machine instructions.
Loops
• A loop is a sequence of statements which is specified once but
which may be carried out several times in succession. The code
"inside" the loop (the body of the loop, shown below as xxx) is
obeyed a specified number of times, or once for each of a collection
of items, or until some condition is met, or indefinitely.
• In functional programming languages, such as Haskell and Scheme,
loops can be expressed by using recursion or fixed point
iteration rather than explicit looping constructs. Tail recursion is a
special case of recursion which can be easily transformed to
iteration.
Count – Controlled loops
• Main article: For loop
• Most programming languages have constructions for
repeating a loop a certain number of times. In most
cases counting can go downwards instead of upwards
and step sizes other than 1 can be used.
• FOR I = 1 TO N | for I := 1 to N do begin xxx | xxx
NEXT I | end; -------------------------------------------------
----------- DO I = 1,N | for ( I=1; I<=N; ++I ) { xxx | xxx
END DO | }
Thank you

More Related Content

What's hot (20)

PPTX
Survelaine murillo ppt
Survelaine Murillo
 
PPTX
Compiler construction
Muhammed Afsal Villan
 
PPTX
Pseudo code
Arindam Ghosh
 
PPTX
Choice router
Rahul Kumar
 
DOCX
Mi0041 java and web design
Study Stuff
 
PPT
Learn Java language fundamentals with Unit nexus
Unit Nexus Pvt. Ltd.
 
DOCX
Mi0041 java and web design
smumbahelp
 
PPTX
Procedural programming
Anbarasan Gangadaran
 
PPT
Programming Paradigms
Directi Group
 
DOCX
Mi0041 java and web design
smumbahelp
 
DOCX
Mi0041 java and web design
smumbahelp
 
PPTX
Structure of the compiler
Sudhaa Ravi
 
PDF
201707 CSE110 Lecture 03
Javier Gonzalez-Sanchez
 
PPTX
MDA Framework
baran19901990
 
PDF
Doppl development iteration #4
Diego Perini
 
PPT
Introduction to programing languages part 3
university of education,Lahore
 
PPTX
Polymorphism
CME
 
PDF
Dependent Types for Cryptography Implementations
Paulo Silva
 
PPTX
Compiler lecture 04
University of Chitral
 
PPTX
Type checking in compiler design
Sudip Singh
 
Survelaine murillo ppt
Survelaine Murillo
 
Compiler construction
Muhammed Afsal Villan
 
Pseudo code
Arindam Ghosh
 
Choice router
Rahul Kumar
 
Mi0041 java and web design
Study Stuff
 
Learn Java language fundamentals with Unit nexus
Unit Nexus Pvt. Ltd.
 
Mi0041 java and web design
smumbahelp
 
Procedural programming
Anbarasan Gangadaran
 
Programming Paradigms
Directi Group
 
Mi0041 java and web design
smumbahelp
 
Mi0041 java and web design
smumbahelp
 
Structure of the compiler
Sudhaa Ravi
 
201707 CSE110 Lecture 03
Javier Gonzalez-Sanchez
 
MDA Framework
baran19901990
 
Doppl development iteration #4
Diego Perini
 
Introduction to programing languages part 3
university of education,Lahore
 
Polymorphism
CME
 
Dependent Types for Cryptography Implementations
Paulo Silva
 
Compiler lecture 04
University of Chitral
 
Type checking in compiler design
Sudip Singh
 

Similar to Machine control flow (20)

PPTX
Fundamentals of programming
Kaycee Parcon
 
DOCX
Programming topics. syed arslan rizvi
Syed Arslan Rizvi
 
ODP
OOP java
xball977
 
PPTX
Loops
ShivamPatel466
 
DOCX
Training 8051Report
Kuldeep Kaushik
 
PPTX
godly_designuquwuwuw1122r45iwieiw566wii.pptx
raz255922
 
PDF
8 statement-level control structure
jigeno
 
PDF
Password protected diary
SHARDA SHARAN
 
PPTX
PowerShell Zero To Hero Workshop!
Daisy Stevens
 
PDF
Shown below is a VLIW system in which each long instruction word gen.pdf
ARCHANASTOREKOTA
 
PDF
Matlab loops 2
pramodkumar1804
 
PDF
Matlab loops
pramodkumar1804
 
PPTX
Question Pattern in Structure Programming
Suman Mia
 
PPTX
APP_Unit 1_updated.pptx
gogulram2
 
PPTX
Switch case and looping statement
_jenica
 
PDF
Clojure and The Robot Apocalypse
elliando dias
 
PPTX
Final requirement
arjoy_dimaculangan
 
PPTX
Switch case and looping statements
Joseph Daniel Soriano
 
PPT
Chap06
Dr.Ravi
 
PPTX
The Loops
Krishma Parekh
 
Fundamentals of programming
Kaycee Parcon
 
Programming topics. syed arslan rizvi
Syed Arslan Rizvi
 
OOP java
xball977
 
Training 8051Report
Kuldeep Kaushik
 
godly_designuquwuwuw1122r45iwieiw566wii.pptx
raz255922
 
8 statement-level control structure
jigeno
 
Password protected diary
SHARDA SHARAN
 
PowerShell Zero To Hero Workshop!
Daisy Stevens
 
Shown below is a VLIW system in which each long instruction word gen.pdf
ARCHANASTOREKOTA
 
Matlab loops 2
pramodkumar1804
 
Matlab loops
pramodkumar1804
 
Question Pattern in Structure Programming
Suman Mia
 
APP_Unit 1_updated.pptx
gogulram2
 
Switch case and looping statement
_jenica
 
Clojure and The Robot Apocalypse
elliando dias
 
Final requirement
arjoy_dimaculangan
 
Switch case and looping statements
Joseph Daniel Soriano
 
Chap06
Dr.Ravi
 
The Loops
Krishma Parekh
 
Ad

More from VENNILAV6 (20)

PPTX
WORKING WITH GRAPHICS
VENNILAV6
 
PPTX
CREATING A MASTER PAGE
VENNILAV6
 
PPTX
CREATING A NEW PUBLICATION IN PAGEMAKER
VENNILAV6
 
PPTX
Relational algebra
VENNILAV6
 
PPTX
Joins & constraints
VENNILAV6
 
PPTX
STRUCTURE OF SQL QUERIES
VENNILAV6
 
PPTX
Database architecture
VENNILAV6
 
PPTX
Data definition language
VENNILAV6
 
PPTX
INTERCONNECTION STRUCTURE
VENNILAV6
 
PPTX
CACHE MEMORY
VENNILAV6
 
PPTX
COMPUTER FUNCTIONS
VENNILAV6
 
PPTX
EXTERNAL DEVICE
VENNILAV6
 
PPT
CORELDRAW EXAMPLES
VENNILAV6
 
PPT
BASICS OF DATA STRUCTURE
VENNILAV6
 
PPTX
object oriented system development
VENNILAV6
 
PPTX
virtual function
VENNILAV6
 
PPTX
constructor and destructor
VENNILAV6
 
PPTX
INHERITANCE
VENNILAV6
 
PPTX
BASICS OF MOBILE COMPUTING
VENNILAV6
 
PPT
BASICS OF JAVA
VENNILAV6
 
WORKING WITH GRAPHICS
VENNILAV6
 
CREATING A MASTER PAGE
VENNILAV6
 
CREATING A NEW PUBLICATION IN PAGEMAKER
VENNILAV6
 
Relational algebra
VENNILAV6
 
Joins & constraints
VENNILAV6
 
STRUCTURE OF SQL QUERIES
VENNILAV6
 
Database architecture
VENNILAV6
 
Data definition language
VENNILAV6
 
INTERCONNECTION STRUCTURE
VENNILAV6
 
CACHE MEMORY
VENNILAV6
 
COMPUTER FUNCTIONS
VENNILAV6
 
EXTERNAL DEVICE
VENNILAV6
 
CORELDRAW EXAMPLES
VENNILAV6
 
BASICS OF DATA STRUCTURE
VENNILAV6
 
object oriented system development
VENNILAV6
 
virtual function
VENNILAV6
 
constructor and destructor
VENNILAV6
 
INHERITANCE
VENNILAV6
 
BASICS OF MOBILE COMPUTING
VENNILAV6
 
BASICS OF JAVA
VENNILAV6
 
Ad

Recently uploaded (20)

PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
LDP-2 UNIT 4 Presentation for practical.pptx
abhaypanchal2525
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PDF
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
PPTX
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
PPTX
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
LDP-2 UNIT 4 Presentation for practical.pptx
abhaypanchal2525
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Virus sequence retrieval from NCBI database
yamunaK13
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 

Machine control flow

  • 1. Machine Control flow Control flow By Ms. V.VENNILA, MCA.,M.Phil., Assistant Professor, Bon Secours College for Women, Thanjavur.
  • 2. Control flow In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperativeprogram are executed or evaluated. The emphasis on explicit control flow distinguishes an imperative programming language from a declarative programming language. Within an imperative programming language, a control flow statement is a statement that results in a choice being made as to which of two or more paths to follow. For non-strict functional languages, functions and language constructs exist to achieve the same result, but they are usually not termed control flow statements. A set of statements is in turn generally structured as a block, which in addition to grouping, also defines a lexical scope.
  • 3. Categories The kinds of control flow statements supported by different languages vary, but can be categorized by their effect: Continuation at a different statement (unconditional branch or jump) Executing a set of statements only if some condition is met (choice - i.e., conditional branch) Executing a set of statements zero or more times, until some condition is met (i.e., loop - the same as conditional branch) Executing a set of distant statements, after which the flow of control usually returns (subroutines, coroutines, and continuations) Stopping the program, preventing any further execution (unconditional halt)
  • 4. Minimal structured control flow • In May 1966, Böhm and Jacopini published an article in Communications of the ACM which showed that any program with gotos could be transformed into a goto-free form involving only choice (IF THEN ELSE) and loops (WHILE condition DO xxx), possibly with duplicated code and/or the addition of Boolean variables (true/false flags). Later authors showed that choice can be replaced by loops (and yet more Boolean variables). • That such minimalism is possible does not mean that it is necessarily desirable; after all, computers theoretically need only one machine instruction(subtract one number from another and branch if the result is negative), but practical computers have dozens or even hundreds of machine instructions.
  • 5. Loops • A loop is a sequence of statements which is specified once but which may be carried out several times in succession. The code "inside" the loop (the body of the loop, shown below as xxx) is obeyed a specified number of times, or once for each of a collection of items, or until some condition is met, or indefinitely. • In functional programming languages, such as Haskell and Scheme, loops can be expressed by using recursion or fixed point iteration rather than explicit looping constructs. Tail recursion is a special case of recursion which can be easily transformed to iteration.
  • 6. Count – Controlled loops • Main article: For loop • Most programming languages have constructions for repeating a loop a certain number of times. In most cases counting can go downwards instead of upwards and step sizes other than 1 can be used. • FOR I = 1 TO N | for I := 1 to N do begin xxx | xxx NEXT I | end; ------------------------------------------------- ----------- DO I = 1,N | for ( I=1; I<=N; ++I ) { xxx | xxx END DO | }