1.if...then...end if數組
if [條件] thenoop
[執行語句]this
end ifspa
能夠嵌套 多個ifinput
if [條件] thenit
[執行語句]變量
else if [條件] thenselect
[執行語句]循環
end ifim
eg.
Dim a,b
a=inputbox("please input a")
b=inputbox("please input b")
if a>b
then
msgbox("a>b")
else if a<b
then
msgbox("a<b")
end if
2.select case 變量名
case 變量值
[執行語句]
case 變量值
[執行語句]
select case var
case 1
msgbox "this is room a"
case 2
msgbox "this is room b"
3. do while
1) do while 條件
[執行語句]
loop
當想要中途退出循環時,可使用exit
2)do
[執行語句]
loop while 條件
先執行語句塊,後面判斷條件
4. while 條件
[執行語句]
wend
5. do while 條件
[執行語句]
loop
until 條件
6.for i=0 to ubound(Array)
[執行語句]
next
ubound表示數組的最大下標,數組下標從0開始,想要中途退出循環可使用exit for
7. for each x in array
[執行語句]
next
想要中途退出循環可使用exit for