Number=Rnd(1,3)
Select case Number
Case 1 Msgbox "Hit 1"
Case 2 Msgbox "Hit 2"
Case 3 Msgbox "Hit 3"
case else Msgbox "No way!"
end select
if number = 1 then
msgbox "hit 1"
else if number=2 then
msgbox "hit 2"
else if number=3 then
msgbox "hit 3"
else
msgbox "no way!"
end if
Same Results... 2 ways... IF alone (Without ElseIf) is more like a 1-0 or a OFF-ON Situation... Those 3 are "conditional statements" IF for 2 Values, ELSEIF or CASE for more.
But i think that ELSE IF is more process consuming right?
If I remember correctly, IF/THEN blocks take more time to execute than a Select/Case, However, the order in wich the cases are presented does matter and may influence the flow in an unexpected way.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.