Similar to suggestions listed here, is it possible to do the same with the continue statement?
Something like this:
for x in range(10):
continue if x<5
Thanks for the help
Similar to suggestions listed here, is it possible to do the same with the continue statement?
Something like this:
for x in range(10):
continue if x<5
Thanks for the help
No, this is not possible in python
you will have to revert to:
for x in range(10):
if x<5:
continue
However, like the comments pointed out you can make a one line if out of that:
if x < 5: continue
I would not recommend using if
statements like that tho since it makes the code harder to read and you do not really gain anything from it.