FANDOM


:If condition:command

In this construct, if the condition is true, the command will be performed. Otherwise, it will not be performed.

(84) :If condition:Then:commands:End
(89) :If condition Then:commands:EndIf

In this construct, if the condition is true, then the commands between the Then and End/EndIf will be performed. Otherwise, the commands between the Then and End/EndIf will be skipped.

(84) :If condition:Then:commands:Else:commands:End
(89) :If condition Then:commands:Else:commands:EndIf

In this construct, if the condition is true, then the commands between the Then and Else will be performed. Otherwise, the commands between the Else and End/EndIf will be performed.

Location Edit

(84)

  • Prgm
  • CTL
  • 1:If

(89)

  • Control
  • 1:If

Example Edit

:Input "NUMBER",X
:If X=5:Then
:Disp "YOUR NUMBER IS 5"
:End

This program will ask the user to input a number. It will display the text "YOUR NUMBER IS 5" only if the number the user enters is 5.

:Input "NUMBER",X
:If X=5
:Disp "YOUR NUMBER IS 5"

This does the same thing as the example at the top, only this one omits the uneeded "Then" and "End" statements, because there is only one command controlled by the "If" condition.

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.