break, continue, pass Statements

break Statement

    break can used to break the loops like for, while

Example
>>> for i in range(10):
...        if i%2 == 0:
...          break
... 

continue Statement

    continue can be used take control to starting of loop

Example
>>> for i in range(10):
...        if i%2 != 0:
...          continue
...

pass Statement

    pass can be used when statement require but without action, like we base class that provides base for inheriting class

Example
>>> def foo():
...        pass

Comments

Popular posts from this blog

Getting Started With Python

Python List

The dir Function