dim a a=inputbox("請輸入一個大于100的數(shù)") a=int(a) 'inputbox返回的是字符串, 我們把他變成整數(shù) if a>100 then msgbox("正確") elseif a=100 then msgbox("老大, 你耍我?") else msgbox("錯誤") end if
Dim a,b,c,d a=inputbox("a是:","輸入半徑") b=Inputbox("b是:","輸入半徑") d=Inputbox("答案:","輸入答案") d=int(d) '在這里我們?nèi)〕隽薲的值, 變成整數(shù), 在放回"d"這個盒子里 c=a*2+b*2 if d=c then Msgbox("你好聰明") else Msgbox("你好豬頭 自己的題還不會!") end if
select case 變量名 case 值 語句 case 值 語句 case else 語句 end select
我們舉個例子就能很簡單的說明:
dim a a=inputbox("輸入一個1--3的值") a=int(a) '處理inputbox返回字符串的問題 select case a case 1 msgbox("壹") case 2 msgbox("貳") case 3 msgbox("叁") case else msgbox("輸入錯誤") end select