The Goto Command on the TI-84 Plus
The Goto command on the TI-84 Plus calculator is used in conjunction with the Lbl (Label) command. The Goto command sends the program to the corresponding Lbl command. The program then executes the commands that follow the Lbl command.
To ensure that the program knows which label (Lbl) to go to, be sure to give the label a one- or two-character name that consists of letters, numbers, or the Greek letter theta. The Goto command then refers to this name when telling the program which label (Lbl) to go to. The Goto command directs the program to a subroutine contained in the program, or terminates the program when a specified condition is satisfied.
The structure for using the Goto command to direct the program to a subroutine contained in the program appears in the first screen. The subroutine consists of the commands that are designated by Commands 2 in this screen.
The program in this screen executes Commands 1, executes Commands 2, and then (if the condition following the If command is true), it executes Commands 2 again. It continues to re-execute Commands 2 until the condition following the If command is false. Then it continues with the program by executing Commands 3.
An example of using the Goto command to execute a subroutine appears in the second screen. At the beginning of the program, the user of the program is asked to enter an integer.
The program then checks to make sure an integer was entered. If an integer was not entered, the program displays the message Enter Integer, and then returns the user to the beginning of the program, once again asking the user to enter an integer.
If an integer is entered, the program continues with the commands that come after the If . . . Then . . . End command appearing in this screen. The request to have the user enter an integer constitutes the subroutine in this program.
When the Goto command directs a program to a label (Lbl), that label can appear in the program either before or after the Goto command. If it appears after the Goto command, the program skips executing all commands that are between the Goto command and the corresponding Lbl command.
The structure for using the Goto command to terminate a program appears in the first screen. In this theoretical program, the program executes Commands 1, and then it continually executes Commands 2 until the condition after the If command is false. The program is terminated by the Stop command only when the condition appearing after the If command is false.
An example of a program that uses the Goto command to terminate a program appears in the second screen. The program in this screen asks the user to enter a number. If the number is less than 1,000, the program displays the square of that number and then prompts the user for another number. The program continues in this fashion until the user enters a number that is greater than or equal to 1,000.