TBasic for Dummies
Lesson 2 |
Onto the next lesson in this tutorial. In this lesson we will learn about another set key commands in BASIC programming. It's the IF-THEN-ELSE-END functions. Here's the program we will use as an example. It may look familiar if you did the last lesson!
PROGRAM: COUNT
:0->A
:Lbl 1
:A+1->A
:Disp A
:IF (A<100)
:THEN
:Goto 1
:ELSE
:Goto 2
:END
:Lbl 2
All of these commands go together so let's get started. If is a question type of thing. Its like this, IF A is LESS THEN 100... THEN (do this). O.k. so after the THEN command you put in what you what it to do. In this case we have it going back to 1. After the then command there is and ELSE. The else tells the calculator what to do if statement turns out false. After the else you tell it what you want it to do. The END command is used to tell the calculator that it is done with the if statement.
Now you don't need to have the ELSE Command. If
you don't include it there is nothing to worry about. The calculator
will skip down to what is end if the equation turns up false. Some people
have a hard time understanding parts of this but there is help! Email me
with your questions: jjdb210@hotmail.com