3 replies
by arg cio
If
a=1 or b=2...AN=40 then goto true
else goto get_input
end if
or you need 40 if statements;
If
input = 1 then goto answer_1
end if
If
input =2 then goto answer_2
end if
...
if
input = 40 then goto answer_40
ELSE goto incorrect_input
end if
otherwise, If may not be the route to go..
getit:
get input$(input_value)
If
input$ <> "" then goto input$
else goto getit
end if
1:
do this
exit
2:
do that
exit
....
40:
do the other thing
exit
I am not an expert VB programmer, but am familiar with it. If there is another way, I'd like to hear it.. hope this helps, good luck, and let me know.
You could use any of these examples or the nested if (if you would like to test against multiple arguments). Here's an example:
If x = 4 Then
y = y + x
ElseIf x = 5 Then
y = y - x + 1
ElseIf x = 6 Then
y = y - x
:
:
End If
-- or --
If x = 4 Then
x = x + 1
Else
If x = 5 Then
x = x - 1
Else
x = x - 2
End If
End If
by ryan
You can use the select case statement. An example is bellow. The first Line just tells the program what it is testing, in relation to an ?if statement? it would be the ?If X=? part. The second line would be the value x should equal. The third line would be the code to run if that statement was true. Your next line being another case or value for x to equal... Hope that helps some.
Select Case X
Case "John"
' Code to run goes here
Case "Ryan"
' Code to run goes here
End Select
This discussion is closed to new replies.
Trending IT Employment posts
Sort by Trending