Control Flow Statements/ Flow Control Statements:
- Generally Python program execution starts from the first line and ends with last line.
- In C,C++,Java,.Net program execution starts from main( ) method.
- By default each statements in the Python program will be executed only once.
- In order to skip the execution of some statements or in order to execute the some statements repeatedly use the flow control statements in python.
Elements of Flow-Control:
In flow control statements w can use the two elements,they are
- Condition
- Block / Clause
Condition:
Any expression which result is Boolean value is known as a condition.
example: >>> 3>5
False
>>> 5<8
True
Block/Clause:
The set of statements which are following same space Indentation.
- Blocks begins with by increasing indentation.
- Blocks can contains some other blocks.
- Blocks ends with by decreasing indentation to zero(0) to appending (containing) block indentation.
- Python program by default itself one block.
- Python supports nested blocks.
Blocking Concept:
Here executing is very easy when compared to curly brace concept.
Flow control statements are categorized in to two types, they are.
- Conditional statements
- Looping statements
No comments:
Post a Comment