What is break continue and pass statement

Break statement
It is used to terminate the loop If it is used in nested loop the current loop will be terminated
Example
for i in range(4):
for j in range(4):
if j==2:
break
print("The number is ",i,j);

Continue statement
It is used to skip the code that comes after it
It checks the if statement if it’s true continue will be executed.
Example
Syntax = continue

Pass statement
It is used when the user doesn’t want any code to excute. So user can place pass where empty code is not allowed
Syntax = pass

1 Like

Correct, keep it up. Give an example of pass and continue statement as well.

1 Like

@kavinkumar300799

Nice explanation, keep the pace up :relaxed:.

1 Like

Example for continue
for i in range(4):
for j in range(4):
if j==2:
continue
print("The number is ",i,j);

Example for pass
def my_func():
print(‘pass inside function’)
pass
my_func()

1 Like

@kavinkumar300799

Correct, keep it up.