FANDOM


: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.

LocationEdit

F2:Control
2:If...Then
3:ElseIf...Then

ExampleEdit

: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."
:Else
::Disp "x≠3,5,9"
:EndIf

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."
:Else
:Disp "x≠3,5,9"
:End

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.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.