while True:
print('계속 반복 중')
break
print('안녕하세요')
# break : 반복문을 강제로 멈추는 명령어
a = 3
while True:
print(a)
if a == 5:
break
a = a + 1
print(a)
# continue : 반복을 멈추지 않고, 특정 조건일 때만 건너뛰기
b = 0
while b < 10:
b += 1 #b = b + 1
if b % 2 == 1:
continue
print(b)
print('----문제----')
c = 0
while c < 15:
c += 1
if c % 3 == 0:
continue
if c == 8:
break
print(c)
print('사과 세기 끝!')
To embed this project on your website, copy the following code and paste it into your website's HTML: