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
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 picture. The subroutine consists of the commands that are designated by commands 2 in this picture.
The program in this picture 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 picture. 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 picture.
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 picture. 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 picture. The program in this picture 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.