# Python CodeRecipe|breakの使い方

Home Python Keywords

# breakの例1

End the loop if i is larger than 3:

    for i in range(9):  if i > 3:    break  
    print(i)

# breakの定義及び使い方

break関数は、 forループ、またはwhile ループを使用します。

# breakの例2

Break out of a while loop:

    i = 1while i < 9:  print(i)  if i == 3:    
    break  i += 1

Related Pages Use the continue keyword to end the current iteration in a loop, but continue with the next. Read more about for loops in our Python For Loops Tutorial. Read more about while loops in our Python While Loops Tutorial.

Home Python Keywords