FIT
100
© Copyright University of Washington 1999-2000
Contrast
Elseif With Nested If
v
ElseIf is not a nested test as seen before, though it is
similar
v
If
txtNum.Text = 1
Then
MsgBox(“John”)
ElseIf
txtNum.Text = 2
Then
MsgBox(“Paul”)
ElseIf
txtNum.Text = 3
Then
MsgBox(“George”)
ElseIf
txtNum.Text = 4
Then
MsgBox(“Ringo”)
Else
MsgBox(“Who?”)
End If
If
txtNum.Text = 1
Then
MsgBox(“John”)
Else
If
txtNum.Text = 2
Then
MsgBox(“Paul”)
Else
If
txtNum.Text = 3
Then
MsgBox(“George”)
Else
If
txtNum.Text = 4
Then
MsgBox(“Ringo”)
Else
MsgBox(“Who?”)
End If
End If
End If
End If