3.2 if语句的基本格式

一、if语句基本格式

  1. 基本语法:

    if 判断条件:
    	条件成立要做的事

    通过缩进判断层级

  2. 案例:

    age = 18
    
    if age >= 18:
        print("成年了")
    
    print("唉,时间真快")

Last updated

Was this helpful?