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

6.pptx
6.pptx6.pptx
Loop structures
Loop structuresLoop structures
Loop structures
tazeem sana
 
Java Repetiotion Statements
Java Repetiotion StatementsJava Repetiotion Statements
Java Repetiotion Statements
Huda Alameen
 
Computer programming 2 Lesson 8
Computer programming 2  Lesson 8Computer programming 2  Lesson 8
Computer programming 2 Lesson 8
MLG College of Learning, Inc
 
python conditional statement.pptx
python conditional statement.pptxpython conditional statement.pptx
python conditional statement.pptx
Dolchandra
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
Skillspire LLC
 
While Loop in python engineering .pdf
While Loop in python engineering    .pdfWhile Loop in python engineering    .pdf
While Loop in python engineering .pdf
miteshchaudhari4466
 
Cpp loop types
Cpp loop typesCpp loop types
Cpp loop types
Rj Baculo
 
Flow control in c++
Flow control in c++Flow control in c++
Flow control in c++
Subhasis Nayak
 
nuts and bolts of c++
nuts and bolts of c++nuts and bolts of c++
nuts and bolts of c++
guestfb6ada
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
Mushiii
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#
Prasanna Kumar SM
 
Control_Statements.pptx
Control_Statements.pptxControl_Statements.pptx
Control_Statements.pptx
Koteswari Kasireddy
 
Control statements
Control statementsControl statements
Control statements
CutyChhaya
 
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
ramireddyobulakondar
 
Do While Repetition Structure
Do While Repetition StructureDo While Repetition Structure
Do While Repetition Structure
Shahzu2
 
Lecture 7 Control Statements.pdf
Lecture 7 Control Statements.pdfLecture 7 Control Statements.pdf
Lecture 7 Control Statements.pdf
SalmanKhurshid25
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
deekshagopaliya
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
deekshagopaliya
 
Matlab loops 2
Matlab loops 2Matlab loops 2
Matlab loops 2
pramodkumar1804
 

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

What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 

Recently uploaded (20)

What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 

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.