주어진 조건을 판단하여 조건이 참일 동안 특정한 명령문을 반복적으로 수행하는 것
▶ 기본 문법
while 조건문:
반복적으로 수행할 문장1
반복적으로 수행할 문장2
...
▶ 주의해야할 문법 :
--- Hello world 3번 출력
loop = 0
while loop <= 2:
loop += 1
print("Hello world")
a = 1
while True:
print("무한루프", a)
a += 1
a = 1
while True:
print("무한루프", a)
if a > 2:
break
a += 1
a = 1
while a < 10:
a += 1
if a % 2 == 0:
continue
print(a)