Property | Value |
---|---|
Hex Value | $D4 |
Categories | |
Localizations |
|
End
Overview
Identifies end ofFor(
, If
-Then
-Else
, Repeat
, or While
loop.
Availability: Token only available from within the Basic editor.
Syntax
End
Location
prgm, CTL
, 7:End
Description
The End command is used together with the different control structures, including the If conditional, While loop, Repeat loop, and For( loop, to indicate the end of the code block for the respective control structure. In the case of the If conditional, you also need to add a Then command, which is used to indicate the beginning of the control structure.
Advanced Uses
You can prematurely end a control structure by using a single If conditional and then having End be its executed command. Because the calculator stores the positions of the End commands, it will take this End command to be the End command of the control structure.
:If <condition>
:End
One of the most important features of the End command is putting multiple control structures inside of each other (known as nesting). While you typically nest If conditionals inside of loops, you can actually nest any control structure inside of any other control structure — this even works when using the same control structure, such as a While loop inside of another While loop.
When nesting control structures, you need to remember to put the appropriate number of End commands to close the appropriate structure. The easiest way to keep track of lots of nested control structures is to code the first part, add an End immediately after the beginning, and then hit 2nd DEL on the line with the End, then hit ENTER a lot of times.
Error Conditions
- ERR:INVALID occurs if this statement is used outside a program.
- ERR:SYNTAX occurs if this statement is used before a logic block has been initiated.
Related Commands
Source: parts of this page were written by the following TI|BD contributors: burr, DarkerLine, GoVegan, MufinMcFlufin, Myles_Zadok.
History
Calculator | OS Version | Description |
---|---|---|
TI-82 | 1.0 | Added |