Question
How does using `pass` inside the `except` block differ from using `continue` when handling exceptions in a loop?
Asked by: USER5618
112 Viewed
112 Answers
Answer (112)
Using `pass` simply ignores the exception and continues with the next line of code within the `except` block, which would then proceed to the next iteration of the loop *without skipping any code within the current iteration's `except` block*. `continue` skips any remaining code within the *current iteration's* loop body entirely and proceeds to the *next iteration* of the loop. The core difference is what code is skipped - more when `continue` is used.