12-22-2022, 01:55 AM
One thing of note here: ELSEIF is not the same as ELSE IF. Some folks think they're the same thing, just formatted slightly different for readability. They're not!
ELSEIF is a continuation of an existing IF statement, offering a different option to the previous choices. ELSE IF is a completely new and unrelated IF statement, with no regard to the first beyond the fact that it occurs IF they previous conditions don't occur.
A segment of code will probably highlight the difference between the two better than I could explain:
Notice the number of END IFs needed in both versions. They're definitely not the same command!
ELSEIF is a continuation of an existing IF statement, offering a different option to the previous choices. ELSE IF is a completely new and unrelated IF statement, with no regard to the first beyond the fact that it occurs IF they previous conditions don't occur.
A segment of code will probably highlight the difference between the two better than I could explain:
Code: (Select All)
If a Then
Print a
ElseIf b Then
Print b
ElseIf c Then
Print c
Else
Print d
End If
If a Then
Print a
Else If b Then
Print b
Else If c Then
Print c
Else
Print d
End If
End If
End If
Notice the number of END IFs needed in both versions. They're definitely not the same command!