SlideShare a Scribd company logo
1 of 11
STATEMENT’S AND LOOP’S
DEFINATION AND EXAMPLES
BY BILAL AHMED
STATEMENT’S
JavaScript support four decision making statements which are as
follows:
If
If-else
If-else if
switch
IF STATEMENT
If statement executes a block of
statement based on a logical
Boolean condition.
• if this condition is true the
block following the statement
is executed.
• If the condition is false the
block after the if statement is
not executed and after
statement block is executed.
IF-ELSE STATEMENT
Sometime If is required to
define a block of statement to
be executed when a condition is
evaluated to false. This is done
using the if-else statement.
if else statement begins with the
If Block which is followed by the
else block
IF-ELSE IF STATEMENT
If else statement allows you to check
multiple condition and specify a different
block to be executed for each condition.
The flow of these statements begins with
the If statement followed by multiple else
If statement and finally by an optional
else block
If the condition in the If statement is false
the condition in the immediate else If
statement is evaluated
SWITCH-CASE STATEMENT
A program becomes quite
difficult to understand when
they are multiple if statements
to simplify coding Switch-case
statement is used.
This statement allows
comparing a variable or
expression with multiple values.
LOOP’S
JavaScript supports Three Types of loops that are as follows:
While Loop
For Loop
Do-while Loop
WHILE LOOP
The while loop executes a block
of code as long as the given
condition remains true.
The while loop begins with while
keyword which is followed by
parentheses containing a
Boolean condition.
FOR LOOP
The for loop is similar to while
loop in functionality It executes
the statements within the loop
as long as the given condition is
true.
Unlike while loop the for loop
specifies the loop control
statements at the top instead in
the body of the loop.
DO-WHILE LOOP
The do-while loop is similar to
while loop This is because both
the do-while and while loops
execute until the condition
becomes false.
However the do-while loop
executes the body of loop at
least once before evaluating the
condition.
STATEMENT’S AND LOOP’S

More Related Content

Similar to STATEMENT’S AND LOOP’S

Similar to STATEMENT’S AND LOOP’S (20)

6.pptx
6.pptx6.pptx
6.pptx
 
Loop structures
Loop structuresLoop structures
Loop structures
 
Java Repetiotion Statements
Java Repetiotion StatementsJava Repetiotion Statements
Java Repetiotion Statements
 
Computer programming 2 Lesson 8
Computer programming 2  Lesson 8Computer programming 2  Lesson 8
Computer programming 2 Lesson 8
 
python conditional statement.pptx
python conditional statement.pptxpython conditional statement.pptx
python conditional statement.pptx
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
While Loop in python engineering .pdf
While Loop in python engineering    .pdfWhile Loop in python engineering    .pdf
While Loop in python engineering .pdf
 
Cpp loop types
Cpp loop typesCpp loop types
Cpp loop types
 
Flow control in c++
Flow control in c++Flow control in c++
Flow control in c++
 
nuts and bolts of c++
nuts and bolts of c++nuts and bolts of c++
nuts and bolts of c++
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#
 
Control_Statements.pptx
Control_Statements.pptxControl_Statements.pptx
Control_Statements.pptx
 
Control statements
Control statementsControl statements
Control statements
 
Control Structures Python like conditions and loops
Control Structures Python like conditions and loopsControl Structures Python like conditions and loops
Control Structures Python like conditions and loops
 
Do While Repetition Structure
Do While Repetition StructureDo While Repetition Structure
Do While Repetition Structure
 
Lecture 7 Control Statements.pdf
Lecture 7 Control Statements.pdfLecture 7 Control Statements.pdf
Lecture 7 Control Statements.pdf
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Matlab loops 2
Matlab loops 2Matlab loops 2
Matlab loops 2
 

Recently uploaded

Poster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfPoster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdf
Alexander Litvinenko
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
heathfieldcps1
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
Krashi Coaching
 

Recently uploaded (20)

Poster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfPoster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdf
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
 
Word Stress rules esl .pptx
Word Stress rules esl               .pptxWord Stress rules esl               .pptx
Word Stress rules esl .pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading RoomImplanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
Benefits and Challenges of OER by Shweta Babel.pptx
Benefits and Challenges of OER by Shweta Babel.pptxBenefits and Challenges of OER by Shweta Babel.pptx
Benefits and Challenges of OER by Shweta Babel.pptx
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 

STATEMENT’S AND LOOP’S

  • 1. STATEMENT’S AND LOOP’S DEFINATION AND EXAMPLES BY BILAL AHMED
  • 2. STATEMENT’S JavaScript support four decision making statements which are as follows: If If-else If-else if switch
  • 3. IF STATEMENT If statement executes a block of statement based on a logical Boolean condition. • if this condition is true the block following the statement is executed. • If the condition is false the block after the if statement is not executed and after statement block is executed.
  • 4. IF-ELSE STATEMENT Sometime If is required to define a block of statement to be executed when a condition is evaluated to false. This is done using the if-else statement. if else statement begins with the If Block which is followed by the else block
  • 5. IF-ELSE IF STATEMENT If else statement allows you to check multiple condition and specify a different block to be executed for each condition. The flow of these statements begins with the If statement followed by multiple else If statement and finally by an optional else block If the condition in the If statement is false the condition in the immediate else If statement is evaluated
  • 6. SWITCH-CASE STATEMENT A program becomes quite difficult to understand when they are multiple if statements to simplify coding Switch-case statement is used. This statement allows comparing a variable or expression with multiple values.
  • 7. LOOP’S JavaScript supports Three Types of loops that are as follows: While Loop For Loop Do-while Loop
  • 8. WHILE LOOP The while loop executes a block of code as long as the given condition remains true. The while loop begins with while keyword which is followed by parentheses containing a Boolean condition.
  • 9. FOR LOOP The for loop is similar to while loop in functionality It executes the statements within the loop as long as the given condition is true. Unlike while loop the for loop specifies the loop control statements at the top instead in the body of the loop.
  • 10. DO-WHILE LOOP The do-while loop is similar to while loop This is because both the do-while and while loops execute until the condition becomes false. However the do-while loop executes the body of loop at least once before evaluating the condition.