HOME ABOUT MORE
CONTROL
STRUCTURES
HOME ABOUT MORE
In programming, a conditional
statement is a command that lets the
computer decide what to do based on
a condition (True or False). If
something is true, do this. Otherwise,
CONDITIONAL do something else. This statements
STATEMENTS include; if, elif, else and if else.
Why Do We Use Them?
• To make decisions in our code
• To perform different actions
depending on different situations
• To control the flow of the program
HOME ABOUT MORE
IF STATEMENT
Use when you want to check one
condition. Only runs if the
condition is True, if False nothing
happens.
HOME ABOUT MORE
ELIF STATEMENT
Use when you have more than 2
choices.
• if → first check
• elif → second check
HOME ABOUT MORE
ELSE STATEMENT
Use else as a final option when no
other conditions are True. No
condition after else. It just catches
all remaining cases.
• if → first check
• elif → second check
• else → if none of the above are
true
HOME ABOUT MORE
IF...ELSE STATEMENT
An if...else statement is a
conditional statement that tells
the computer “Do this if the
condition is true, otherwise do
something else”. Use when you
want two possible outcomes.
HOME ABOUT MORE
A loop is a programming command
that repeats a block of code multiple
times until a certain condition is met.
LOOP
Why Use Loops?
COMMANDS • To avoid repeating code manually
• To perform a task again and again
• To save time and effort
HOME ABOUT MORE
FOR LOOP Output :
Use it when you know how many
times to repeat.
HOME ABOUT MORE
WHILE LOOP Output :
Use it when you don’t know how
many times yet.
HOME ABOUT MORE
A break statement is used to
immediately stop a loop — even if the
loop condition is still true.
BREAK
Why Use break?
STATEMENT • To exit a loop early when a specific
condition is met.
• To avoid unnecessary repetitions.
• To control the flow more precisely.
HOME ABOUT MORE
BREAK
STATEMENT
Input : Output :
HOME ABOUT MORE
The continue statement is used to
skip the current iteration of the loop
and move to the next one.
CONTINUE
Why Use continue?
STATEMENT • To skip specific values or
conditions inside a loop
• To avoid running certain code
without breaking the whole loop
• To make your loop more flexible
HOME ABOUT MORE
CONTINUE
STATEMENT
Input : Output :
HOME ABOUT MORE
THANK YOU