:If condition Then:commands:ElseIf condition Then:commands:EndIf

This is a combination of an if and an else. If the preceding Ifs all failed (the else part) do these commands if another condition is true. Each ElseIf can be followed by another ElseIf.




:If x=3 Then
:Disp "x=3"
:ElseIf x=9
::Disp "x=9"
:ElseIf x=3 or x=5
::Disp "x=5, but not 3"
:ElseIf x=5
::Disp "This will never be seen."
::Disp "x≠3,5,9"

Only one of the five Disp statements in this If block will be called. If x is 3, the first block will call, but none of the others, including the third one. If x is 9, the second block will be called. If x is 5, the third block will be called, but none of the others. The fifth block will be called if x is anything else.

For the TI-84Edit

:If x=3:Then
:Disp "x=3"
:Else:If x=9:Then
:Disp "x=9"
:Else:If x=3 or x=5:Then
:Disp "x=5, but not 3"
:Else:If x=5:Then
:Disp "This will never be seen."
:Disp "x≠3,5,9"

If, on the TI-84, you try to use the ElseIf statement, it will return an error. Instead, you must make it so that the two are separated by a colon in order to properly work.