The TI-84 Plus calculator can handle three looping commands. The structure of the While . . . End command appears in the first screen. If the condition following the While command is true, the program executes the commands between While and End (Commands 1) and then returns to the While command to see whether the condition following it is still true.

If it is, the program again executes the commands between While and End (Commands 1) and then returns to the While command to see whether the condition following it is still true. If the condition following the While command is false, the program skips the commands between While and End (commands 1) and then moves on to the next command in the program (Command 2).

To make the While command work, the commands appearing between While and End (Commands 1) must change the value of the variable used in the condition that follows the While command. If the value of this variable does not change and the condition is true, you wind up in an infinite loop. That is, the calculator continues to execute the While command until you stop it or the batteries die.

If you find that your program inadvertently contains an infinite loop (or if it is just taking too long to execute the program and you’d like to stop the execution), press [ON]. You are then confronted with the ERROR: BREAK error message, which gives you the option to Quit the execution of the program.

An example of using the While . . . End command appears in the second screen. The program in this screen starts with the given integer N and divides it by 2 if it is even; if it isn’t, it adds 3 to the N.

The program then takes the resulting number and divides it by 2 if it is even, or adds 3 to it if it isn’t. This process continues until the resulting number is 1. The first End command appearing in this program marks the end of the If . . . Then . . . Else . . . End command; the second marks the end of the While . . . End command.