If we want to bypass any code pass statement can be used.
Continue |
Pass |
s
= "python" #
Continue statement for
i in s: if i == 'h': print('Continue executed') continue print(i) |
s
= "python" #
Pass statement for
i in s: if i == 'h': print('Pass executed') pass print(i) print() |
P y t Continue
executed o n |
P y t Pass
executed h o n
|
Difference b/w pass and break and continue
Pass |
Break |
Continue |
s
= "python" #
Pass statement print("example
on pass") for
i in s: if i == 'h': print('Pass
executed') pass print(i) print() |
#
break statement s
= "python" print("break
example") for
i in s: if i == 'h': print('break
executed') break print(i) |
s
= "python" #
Continue statement print("example
on continue") for
i in s: if i == 'h': print('Continue
executed') continue print(i) |
example
on pass p y t Pass
executed h o n |
break
example p y t break
executed |
example
on continue p y t Continue
executed o n |
No comments:
Post a Comment