| Ti-83 Basic | |||
| The Basics 1.1: Getting Started 1.2: The "Disp" Command 1.3: The "Input" Command 1.4: Strings 1.5: If-Then Statements 1.6: "For" Loops 1.7: "While" Loops 1.8: The "Getkey" Command Creating Menus 2.1: Lbl and Goto Commands 2.2: The "Menu" Command Graphics 3.1: Setting up for Drawing 3.2: Graphing 3.3: Graph-Coordinates Drawing 3.4: Screen-Coordinates Drawing 3.5: Pictures 3.6: "Input" Revisited 3.6: Advanced Menus 3.8: Dynamic Menus 3.9: Dialog Boxes Miscellaneous 4.1: Memory Management 4.2: Creating Lists and Saved Games 4.3: Using with MirageOS 4.4: Tips and Hints | If-Then Statements If then statements work like this: If the variable you request equals what you say, then do the following lines of code. If not, then skip the following lines of code until an "End" is reached. It works like this: :If A=1 :Then :Disp "Hey" :Pause :End :If A=2 :Then :Disp "Bye" :Pause :End If you have ONLY ONE LINE OF CODE under the If, you don't need the "Then" and the "End", for example, This: :If A=1 :Then :Disp "Hey" :End Could be replaced by this: :If A=1 :Disp "Hey" This has the same effect, but will only work on one line! If you have more than one line inside the if-then, be sure to use then and end. For the equals sign, press [2nd],[Test (Math)],[Enter].
:Input "What?",A :If A=1 :Disp "Hi!" :If A=2 :Disp "Bye!" If you want it to do something after all the if-then statements, you know how to do this, but we'll remind you anyway. Put the commands that you always want to be executed after every If-Then statement after all the statements. Basically, add this on to the end of the program you just wrote: :Pause :ClrHome Pause is a command that will wait for you to press enter before it goes on with the rest of the program. It is obtained by pressing [PRGM],[8]. ClrHome clears the home screen. It is obtained by pressing [PRGM],[Right Arrow],[8]. Run the program. It should now ask you for a number. Type in 1 or 2. It should either say "Hi!" or "Bye!", and then wait for you to press enter. After you press enter, it should clear the homescreen, and say "Done". | ||
![]() The text in this tutorial is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. | |||

