if语句格式:
1、单语句:(1) if <条件> then <一条语句>
(2) if <条件> then <一条语句> else <一条语句>
必须写在同一行里
2、块语句
if <条件> then
<多条语句>
else
<多条语句>
end if
说明:then必须放在if语句的后面,必须按照上面的格式换行
3、单条件的嵌套语句
块结构的IF语句可以方便的进行单条件的选择,但是,条件为假时,只能提供一种动作,下面的elseif关键字可实现多条件的选择。
if <条件> then
<多条语句>
elseif <条件> then
<多条语句>
elseif <条件> then
<多条语句>
……
else
<多条语句>
end if
说明:(1)then必须放在if或elseif语句的后面
(2)else是可选项