![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Conditional Statements IntroductionConditional statements are used to make decisions and perform different actions depending on the decision. Conditonal statements If i = 10 then msgbox " Stock is 1200"To perform multiple actions when a condition is true, you must put each statement on separate lines and end the statement with the keyword "End If": If i =10 then msgbox"Stock is 1200" i = i +10 end ifThe "Else" keyword is used when you want to perform one action if the statement is true and another when it is false. If i =10 then msgbox"Stock is 1200" else msgbox" More required" end if If-then-Elseif If value = 0 Then MsgBox value ElseIf value = 1 Then MsgBox value ElseIf value = 2 then Msgbox value Else Msgbox "Value out of range!" Select Case Select case value case "1" msgbox "Less than zero" case "2" msgbox "Greater than zero" case "3" msgbox "Equals zero" case else msgbox"Value unknown" end select
|
|
|
|
Added to the Web: May 26, 2000. Web page design by Dan Solarek. |
![]() http://cset.sp.utoledo.edu/cset3250/ |