Hej there,
I stumbled upon the "continue" statement and to me it looks like it
does exactly the same as else. I tested both else and continue in a
little program and I don't see any differences between both. Is my
assumption correct or wrong? If the latter is the case: Can you give
me examples of continue usage that couldn't be done with else?
Here's my code sample I mentioned above:
for num in range(2,10):
if num % 2 == 0:
print("Found an even number", num)
continue
print("Found a number", num)
Same program with else:
for num in range(2,10):
if num % 2 == 0:
print("Found an even number", num)
else:
print("Found a number", num)
Thanks in advance!
All the best,
Raf
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor