When does a for loop stop iterating?

Advertisement

  • when it encounters an infinite loop
  • when it encounters an if/else statement that contains a break keyword
    when it has assessed each item in the iterable it is working on or a break keyword is encountered
  • when the runtime for the loop exceeds O(n^2)
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend