—–流程控制(一)
—–條件結構
—–1、 if-then 語句
語法
if condition then
Statements
end if;
/*
if 條件 then
語句(條件成立執行該語句!)
end if;
*/
—–2、 if-then-else語句
語法
if condition then
Statements1
else
Statements2
end if;
/*
if 條件 then
語句1(條件成立執行語句1!)
else
語句2(否則,即條件不成立執行語句2!)
end if;
*/
—–3、 if-then-elsif語句
if condition1 then
Statements1
elsif condition2 then –注意是elsif而不是elseif
Statements2
else
Statements3
end if;
/*
if 條件1 then
語句1(條件1成立,執行語句1!)
elsif condition2 then
語句2(條件2,成立執行語句,2!)
else
語句3(否則,即條件不成立執行語句3!)
end if;
*/
/*
整體與if····else·······比較相似,不過具體細節地方需注意:
1、then
2、elsif
3、end if;
*/