× Python Introduction What is Python Python Features Python History Python Applications Python Install Python Path Python Example Execute Python Keywords Constant Variable Statements & Comments Python I/O and Import Operators UnaryBinaryTernary Unary Operators Unary Minus Binary Operators Arithmetic Operators Assignment Operators Relational Operators Logicaloperators Bitwise Operator Ternary Operators Control Statements in Python conditonal Statements IF if else Else If Nested if Switch For loop Nested For Loop While Loop Nested while Loop Unconditonal Statemets Continue Break Pass FUNCTIONS Python Function Function Argument Python Recursion Anonymous Function Python Modules NATIVE DATATYPES Python List Python Numbers Python Tuple Python String Python Set Python Dictionary OOPS PRINCIPALS Encapsulation Class Variable Method Object Or Instance CreationMethod Calling OOPS Syntax And Explanation DATA ABSTRACTION Constructor Inheritance 1.Single or simple Inheritance 2.Multilevel Inheritance 3.Hierarchical Inheritance 4.Multiple Inheritance 5.Hybrid Inheritance Operator Overloading File Operation Python Directory Python Exception Python - Multithreading Python - Database Access Python - CGI Python - Reg Exp Python - Date Python - XML Processing Python - GUI
  • iconPython Online Training In Andhra Pradesh and Telangana
  • icon9010519704

Opening Hours :7AM to 9PM

Unconditional Statements:

UnConditional Statements allows you to direct the program's flow to another part of your program without evaluating conditions.
These are classified into following types.
1. continue
2. break

Key Points

  • What is Continue
  • What is Break
Image
continue Statement:
'continue' statement is used to continue the loop( It skip the one iteration if the condition is true).
Syntax:
if(condition):
    continue
       

Display Even numbers unsing continue statement
def myfun():
    for x in range(1,31,1):
        if(x%2!=0):
            continue
        print(x)

if __name__=="__main__":
    myfun()

Output:
2
4
6
8
10
break Statement:
'break' statement is used to break the loop.
Syntax:
    
if(condition):
    break
       

Break the loop which number divisible 2 and 3
def myfun():
    for x in range(1,31,1):
        if(x%2==0 and x%3==0):
            break
        print(x)
 
if __name__=="__main__":
    myfun()
                                

Output:
1
2
3
4
5