λ°λ³΅λ¬Έ λ΄λΆμμ λ Όλ¦¬ νλ¦μ μ μ΄νλ λ°©λ²
while
λ°λ³΅λ¬Έμμ break
μ continue
ν€μλλ λ°λ³΅λ¬Έμ μ€ν νλ¦μ μ μ΄ν©λλ€.
break
λ λ°λ³΅λ¬Έμ μ¦μ μ’
λ£μν€κ³ , continue
λ νμ¬ λ°λ³΅μ 건λλ°κ³ λ€μ λ°λ³΅μΌλ‘ λμ΄κ°λλ€.
break ν€μλ μ¬μ©νκΈ°
break
ν€μλλ λ°λ³΅λ¬Έ λ΄μμ νΉμ μ‘°κ±΄μ΄ μΆ©μ‘±λλ©΄ λ°λ³΅λ¬Έμ μ¦μ μ’
λ£μν¬ λ μ¬μ©ν©λλ€.
break ν€μλ μμ
count = 0 # count λ³μ μ μΈ λ° μ΄κΈ°ν while True: # 무ν λ°λ³΅λ¬Έ print(count) # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 count += 1 # count = count + 1 if count >= 5: # countκ° 5 μ΄μμ΄λ©΄ break # λ°λ³΅λ¬Έ μ’ λ£ # μΆλ ₯ κ²°κ³Ό: 0, 1, 2, 3, 4
continue ν€μλ μ¬μ©νκΈ°
continue
ν€μλλ νμ¬ λ°λ³΅μ μ¦μ μ’
λ£νκ³ , λ°λ³΅λ¬Έμ λ€μ λ°λ³΅μΌλ‘ λμ΄κ°κ² ν©λλ€.
continue ν€μλ μμ
count = 0 # count λ³μ μ μΈ λ° μ΄κΈ°ν while count < 5: # countκ° 5 λ―Έλ§μ΄λ©΄ count += 1 # count = count + 1 if count == 3: # countκ° 3μ΄λ©΄ continue # λ°λ³΅λ¬Έμ λ€μ λ°λ³΅μΌλ‘ λμ΄κ° print(count) # 1, 2, 4, 5 # μΆλ ₯ κ²°κ³Ό: 1, 2, 4, 5
breakμ continueμ νμ©
-
break
: λ°λ³΅λ¬Έ λ΄μμ νΉμ μ‘°κ±΄μ΄ λ§μ‘±λ κ²½μ°, λ°λ³΅λ¬Έμ μμ ν μ’ λ£ν©λλ€. -
continue
: νΉμ 쑰건μμ μΌλΆ μ½λ μ€νμ 건λλ°κ³ , λ°λ³΅λ¬Έμ κ³μ μ§νν©λλ€.
Guidelines
AI Tutor
Publish
Design
Upload
Notes
Favorites
Help
Code Editor
Run
Generate
Execution Result