TI-BASIC Wiki
Advertisement
(84) :While condition:commands:End
(89) :While condition:commands:EndWhile

The While command performs a group of commands while the condition is true.

The condition is tested when While is Encountered.

If the condition is true, the program executes a group of commands, else the program skips to the line after End.

The while loop is returned to the beginning by End.

While can be nested.

Location[]

  • Prgm
  • CTL
  • 5:While

Example[]

:ClrHome
:While X5
:Input "NUMBER? ",X
:Disp "NOT 5"
:End
:Disp "IT'S 5"

This program asks the user to input the number. Every time that the number is not 5, the program will display "NOT 5" and ask the user for another number. Once the number is 5, the program will display "IT'S 5".

Advertisement