# Python CodeRecipe|elifの使い方

Home Python Keywords

# elifの例1

Print "YES" if the variable i is a positive number, print "WHATEVER" if i 
  is 0, otherwise print "NO":

    for i in range(-5, 5):  if i > 0:    
    print("YES")  elif i == 0:    print("WHATEVER")  
    else:    print("NO")

# elifの定義及び使い方

elif関数は条件付きで使用されます。 ステートメント(if文)、else ifの省略形です。

Related Pages if Keywords. Other Keywords. For more information on conditional statements, see the Python Conditions Tutorial.

Home Python Keywords