+ 2

How do I use continue in a for loop inside a while loop?

This is an example of my code: while something: functions if something: try: functions if something: try: for x in range(something): if something: functions continue except something: functions It give me an IndentationError! What can I do to avoid it? How can I use continue to restart the while loop and not the for loop?

3rd Oct 2018, 1:35 PM
Giordano Fratti
Giordano Fratti - avatar
1 Antwort
+ 9
class Continue(Exception): pass for i in range(5): try: for j in range(5): print('j') if j==3: raise Continue except Continue: continue print('i')
3rd Oct 2018, 2:27 PM
Mert Yazıcı
Mert Yazıcı - avatar