반응형
for i in range(5):
if i == 3:
continue # skip the rest of the code inside loop for current i value
print(i)
for x in range(10):
if x % 2 == 0: # Print only odd the numbers 1, 3, 5, 7, 9.
continue # skip print(x) for this loop
print(x)
산출물 (Output)
0
1
2
4
1
3
5
7
9
* The 'continue' keyword is used to skip the rest of the code inside the loop for the currently executed loop and return to the "for" or "while" statement.
반응형
'Python 배우기' 카테고리의 다른 글
param_args.py (0) | 2016.03.10 |
---|---|
functions.py (0) | 2016.03.10 |
break_keyword.py (0) | 2016.03.10 |
while_loop.py (0) | 2016.03.10 |
for_string.py (0) | 2016.03.09 |
댓글