1、'单行写法 (后面将省去首尾两句)Sub 条件语句()If a < 20 Then [b2] = "good"end sub
2、'多行写法If a < 20 Then[b2] = "shit"End If'if esleIf a < 20 Then[b2] = "yes"Else[b2] = "no"End If
3、'多条件判断If a < 20 Then[b2] = "挢旗扦渌;very bad"ElseIf a < 40 Then[b2] = "bad"ElseIf a < 60 Then[b2] = "normal"Else[b2] = "good"End If
4、单行写法if后,执行多条语句,用冒号隔开If a < 20 Then [b2] = "good": [b3] = "yes"'单行if elseIf a < 20 Then [b2] = "aa" Else [b2] = "bb"
5、总结:if 条件1 then 条件1成立时运行的语句elseif 条件2 then条件2成立运行的语句....else 所有条件都不成立时运行的语句end if