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
 
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
 
Matlab loops
Matlab loopsMatlab loops
Matlab loops
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

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.