Site hosted by Angelfire.com: Build your free website today!
 
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
 

QUIZ:
1. What will the calculator do if A=B in this line of text?
    :If(A=B)
    :THEN
    :Disp "wrong"
    :ELSE
    :Disp "right"
    :END
 
A: Show right
B: Show wrong
C: Nothing at all
D: Count over and over and over and over.....

2. What will the calculator do in the Above program if A DOESN'T EQUAL B?
A: Show right
B: Show wrong
C: Nothing at all
D: Count over and over and over and over.....

3. Where will the calculator goto if you tell it to GOTO calc
A: LBL calc
B: Disp calc
C: LBL c
D: No where, you can't have more then one letter goto's on the 82!


Back to the Contents
Next Lesson