Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Flow Control

Alternatively control flow (when referring to computer programming) is the order function calls, instructions, and statements are executed or evaluated when a program is running. Many programming languages have what are called control flow statements used to determine what section of code is run in a program at a given time.

Types Of Flow Control Statments

This is the most simple form of the branching statements.

It takes an expression in parenthesis and an statement or block of statements. if the expression is true then the statement or block of statements gets executed otherwise these statements are skipped.

The most basic loop is the while loop. A while statement is like a repeating if statement. Like an If statement, if the test condition is true: the statments get executed. The difference is that after the statements have been executed, the test condition is checked again. If it is still true the statements get executed again.This cycle repeats until the test condition evaluates to false.

For loop is similar to while, it's just written differently.Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.

The try block lets you test a block of code for errors. The except block lets you handle the error. The finally block lets you execute code, regardless of the result of the try- and except blocks.

When an error occurs, or exception as we call it, Python will normally stop and generate an error message. These exceptions can be handled using the try statement.

You can check out more examples here.

For more information look into

https://www.tutorialspoint.com/python/python_loops.htm

https://www.w3schools.com/python/python_try_except.asp

https://www.tutorialspoint.com/python/python_while_loop.htm

https://www.programiz.com/python-programming/while-loop