Contrast With Nested If
ElseIf is not a nested test as seen before, though the logic is similar…
If txtNum.Text = 1 Then
Beatle = “John”
ElseIf txtNum.Text = 2 Then
Beatle = “Paul”
ElseIf txtNum.Text = 3 Then
Beatle = “George”
ElseIf txtNum.Text = 4 Then
Beatle = “Ringo”
Else
Beatle = “Who?”
End If
If txtNum.Text = 1 Then
Beatle = “John”
Else
If txtNum.Text = 2 Then
Beatle = “Paul”
Else
If txtNum.Text = 3 Then
Beatle = “George”
Else
If txtNum.Text = 4 Then
Beatle = “Ringo”
Else
Beatle = “Who?”
End If
End If
End If
End If
Previous slide
Next slide
Back to first slide
View graphic version