SlideShare a Scribd company logo
Dr.A.Bharathi Lakshmi,
Head and Assistant Professor of IT,
V.V.Vanniaperumal College for Women,
Virudhunagar.
Controlling Program Flow
• Decision statements
 Execute stmts. based on the condition
 If…Then
 If…Then…Else
 If…Then..ElseIf..Else
 Select…Case
• Looping Statement
 Set of statements will be executed repeatedly until
a specific condition
 While…End While
 Do…Loop
 For…Next
 For…Each…Next
Decision Statements
 If…Then
• To execute a block of code based on a
certain condition
Syntax
If <<condition>> Then
‘Statements to be
executed
End If
Decision Statements
 If…Then…Else
• Same as If…Then
• Two blocks of code can be executed
for true case as well as for false case
Syntax
If <<condition>> Then
‘Execute Statements if condition is true
Else
‘Execute Statements if condition is false
End If
Decision Statements
 If…Then…Elseif
• Same as If…Then
• Multiple blocks of code can be executed for
true case as well as for false case
Syntax
If <<condition1>> Then
‘Execute Statements if condition is true
Else If <<condition2>> Then
‘Execute Statements if condition2 is true
.
.
.
Else
‘Execute Statements if all the conditions are false
End If
Decision Statements
 Select…Case Statement
• Execute a group of statements based on the
test expression
• Can be a single variable or complex
expression
Syntax
Select <<testvalue>>
‘Execute a set of statements
Case <<value1>>
‘Execute a set of statements
Case <<value2>>
‘Execute a set of statements
Case <<value3>>
‘Execute a set of statements
Case Else
‘Execute a set of statements
End Select
Looping Statements
 While…End While
• Set of statements will be executed
until the condition becomes false.
Syntax
While <<condition>>
‘Executes statements
End While
Looping Statements
 Do…Loop
• Same as while loop
• Executes the block of code first without
evaluating the condition
• Then the condition is evaluated
Syntax
do
‘Executes statements
Loop While <<condition>>
Looping Statements
 For…Next Statement
• Same as while…end while
• Block of code will be executed for a
fixed number of times.
Syntax
For <<varnam>>=<<start>> to <<end>>
Step <<value>>
‘Executes statements
Next
Looping Statements
 For…Each…Next Statement
• Similar to For...Next statement
• Enables to traverse through a collection
such as an array or a row of a table.
Syntax
For each <<varnam>> In <<array name or collection>>
‘Executes statements
Next
Examples
Dim I as integer
For Each I in Arrnam
Console.WriteLine(arrnam(i))
Next

More Related Content

PPTX
controlStatement.pptx, CONTROL STATEMENTS IN JAVA
PPTX
Unit_3A_If_Else_Switch and a if else statment example
PPTX
BSc. III Unit iii VB.NET
PPT
Decision making and branching
PPT
_Java__Expressions__and__FlowControl.ppt
PPT
_Java__Expressions__and__FlowControl.ppt
PPTX
Lec-5-IF-ELSE-SWITCH Programming Fundamentals.pptx
PPTX
Control statements in java
controlStatement.pptx, CONTROL STATEMENTS IN JAVA
Unit_3A_If_Else_Switch and a if else statment example
BSc. III Unit iii VB.NET
Decision making and branching
_Java__Expressions__and__FlowControl.ppt
_Java__Expressions__and__FlowControl.ppt
Lec-5-IF-ELSE-SWITCH Programming Fundamentals.pptx
Control statements in java

Similar to .Net Controlling Program Flow Statements (20)

PDF
Lecture 8
PPTX
DECISION MAKING AND BRANCHING - C Programming
DOCX
Lecture 26.07.2014
PDF
Control structures IN SWIFT
PPTX
Programming Fundamentals in C++ structures
PPTX
PPTX
Java Control Statements
PPTX
Decision statements in vb.net
PPTX
Flow Control (C#)
PPTX
C Programming: Control Statements in C Pgm
PPTX
Object oriented programming_Unit1_contro statements.pptx
PPTX
Constructs (Programming Methodology)
PPSX
Control Structures in Visual Basic
PPTX
VB.Net Mod2.pptx
PPTX
Decision statements
PPTX
Computer programming 2 Lesson 9
PPTX
Computer programming 2 - Lesson 7
DOCX
Chapter 4(1)
PPT
control-statements detailed presentation
PDF
VB PPT by ADI PART3.pdf
Lecture 8
DECISION MAKING AND BRANCHING - C Programming
Lecture 26.07.2014
Control structures IN SWIFT
Programming Fundamentals in C++ structures
Java Control Statements
Decision statements in vb.net
Flow Control (C#)
C Programming: Control Statements in C Pgm
Object oriented programming_Unit1_contro statements.pptx
Constructs (Programming Methodology)
Control Structures in Visual Basic
VB.Net Mod2.pptx
Decision statements
Computer programming 2 Lesson 9
Computer programming 2 - Lesson 7
Chapter 4(1)
control-statements detailed presentation
VB PPT by ADI PART3.pdf
Ad

More from BharathiLakshmiAAssi (20)

PPT
.Net IDE Components and Applications
PPTX
Fundamentals of .Net Programming concepts
PPTX
VB.net&OOP.pptx
PPTX
VB.netIDE.pptx
PPT
VB.Net-Introduction.ppt
PPT
File Allocation Methods.ppt
PPTX
Demand Paging.pptx
PPTX
Virtual Memory.pptx
PPTX
Knowing about Computer SS.pptx
PPSX
Parallel Computing--Webminar.ppsx
PPSX
PPSX
Iterative Algorithms.ppsx
PPSX
Intensity Transformation.ppsx
PPSX
MAtrix Multiplication Parallel.ppsx
PPSX
Web Designing.ppsx
PPSX
Graphics Designing-Intro.ppsx
PPSX
Intensity Transformation & Spatial Filtering.ppsx
PPSX
DIP Slide Share.ppsx
PPSX
Class Timetable.ppsx
PPSX
.Net IDE Components and Applications
Fundamentals of .Net Programming concepts
VB.net&OOP.pptx
VB.netIDE.pptx
VB.Net-Introduction.ppt
File Allocation Methods.ppt
Demand Paging.pptx
Virtual Memory.pptx
Knowing about Computer SS.pptx
Parallel Computing--Webminar.ppsx
Iterative Algorithms.ppsx
Intensity Transformation.ppsx
MAtrix Multiplication Parallel.ppsx
Web Designing.ppsx
Graphics Designing-Intro.ppsx
Intensity Transformation & Spatial Filtering.ppsx
DIP Slide Share.ppsx
Class Timetable.ppsx
Ad

Recently uploaded (20)

PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Insiders guide to clinical Medicine.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Institutional Correction lecture only . . .
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Pharma ospi slides which help in ospi learning
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Basic Mud Logging Guide for educational purpose
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
PPH.pptx obstetrics and gynecology in nursing
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
human mycosis Human fungal infections are called human mycosis..pptx
Insiders guide to clinical Medicine.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Institutional Correction lecture only . . .
Abdominal Access Techniques with Prof. Dr. R K Mishra
Microbial disease of the cardiovascular and lymphatic systems
Pharma ospi slides which help in ospi learning
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
VCE English Exam - Section C Student Revision Booklet
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Basic Mud Logging Guide for educational purpose
Anesthesia in Laparoscopic Surgery in India
Module 4: Burden of Disease Tutorial Slides S2 2025
PPH.pptx obstetrics and gynecology in nursing

.Net Controlling Program Flow Statements

  • 1. Dr.A.Bharathi Lakshmi, Head and Assistant Professor of IT, V.V.Vanniaperumal College for Women, Virudhunagar.
  • 2. Controlling Program Flow • Decision statements  Execute stmts. based on the condition  If…Then  If…Then…Else  If…Then..ElseIf..Else  Select…Case • Looping Statement  Set of statements will be executed repeatedly until a specific condition  While…End While  Do…Loop  For…Next  For…Each…Next
  • 3. Decision Statements  If…Then • To execute a block of code based on a certain condition Syntax If <<condition>> Then ‘Statements to be executed End If
  • 4. Decision Statements  If…Then…Else • Same as If…Then • Two blocks of code can be executed for true case as well as for false case Syntax If <<condition>> Then ‘Execute Statements if condition is true Else ‘Execute Statements if condition is false End If
  • 5. Decision Statements  If…Then…Elseif • Same as If…Then • Multiple blocks of code can be executed for true case as well as for false case Syntax If <<condition1>> Then ‘Execute Statements if condition is true Else If <<condition2>> Then ‘Execute Statements if condition2 is true . . . Else ‘Execute Statements if all the conditions are false End If
  • 6. Decision Statements  Select…Case Statement • Execute a group of statements based on the test expression • Can be a single variable or complex expression Syntax Select <<testvalue>> ‘Execute a set of statements Case <<value1>> ‘Execute a set of statements Case <<value2>> ‘Execute a set of statements Case <<value3>> ‘Execute a set of statements Case Else ‘Execute a set of statements End Select
  • 7. Looping Statements  While…End While • Set of statements will be executed until the condition becomes false. Syntax While <<condition>> ‘Executes statements End While
  • 8. Looping Statements  Do…Loop • Same as while loop • Executes the block of code first without evaluating the condition • Then the condition is evaluated Syntax do ‘Executes statements Loop While <<condition>>
  • 9. Looping Statements  For…Next Statement • Same as while…end while • Block of code will be executed for a fixed number of times. Syntax For <<varnam>>=<<start>> to <<end>> Step <<value>> ‘Executes statements Next
  • 10. Looping Statements  For…Each…Next Statement • Similar to For...Next statement • Enables to traverse through a collection such as an array or a row of a table. Syntax For each <<varnam>> In <<array name or collection>> ‘Executes statements Next Examples Dim I as integer For Each I in Arrnam Console.WriteLine(arrnam(i)) Next