| 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 | "For" Loops A "For" loop goes from a starting number to an ending number, hitting a specified interval of numbers in between. If I go between 1 and 50, then the code inside the For loop will be executed 50 times. Here's a sample: ClrHome For(A,1,10) Disp A EndThis will count A from 1 to 10, displaying it on the screen each time. So the output would be: 1 2 3 4 5 6 7 8 9 10So what can the For loop be used for, besides counting? Well, consider the following code to create a simple multiplication table: ClrHome For(I,0,3) For(J,0,3) Disp I*J End EndNote that I put one loop inside another, so the line "Disp I*J" is actually executed 16 times.
For loops are also useful for reading elements from a list, though more on this later. |
![]() The text in this tutorial is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. | |

