...

/

The break and continue Keyword

The break and continue Keyword

In this lesson, we'll learn the use of 'break' and 'continue' keyword in loops.

When adding a loop, we always decide the terminating condition. Let’s say we need to print first n numbers; so we can write our loop as:

for n in range(0, 10):
  print(n)

The break Keyword

What if, we need to exit a loop before it reaches the end? ...