Skip to content

Latest commit

 

History

History
43 lines (37 loc) · 1.33 KB

LOOPS.md

File metadata and controls

43 lines (37 loc) · 1.33 KB

Loops

In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. There may be a situtation when you need to execute a block of code several number of times.
Programming language provides various control structures that allow for more complicated execution paths.
A loop statement allows us to execute a statement or group of statements mutliple times.
Python provides following types of loops to handle looping requirements.

S.No. Loop Type Description
1. while loop It repeats a statement or group of statements while a given condition is TRUE. it tests the condition before executing the loop body
2. for loop It executes a sequence of statements multiple times and abbreviates the code that manages the loop variable
3. nested loop It helps in using one or more loop inside any other while, for or while loop.

NOTE

Python does not support do...while loop, which in general is supported by other programming languages.