While Loop

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 3

WHILE LOOP

Why ‘while’ loop?

- Allows code to be executed repeatedly based on a given Boolean condition

General Format (other languages)


FOR LOOP
Why ‘for’ loop?

- Allows code to be executed repeatedly


- Used where we already know about the number of times loop needs to be executed
IF - ELSE
STATEMENT

- Used for conditional statements


- Nested if-else
- Chained if-else
Basic if-else code in python

You might also like