beautypg.com

While, Repeat – Texas Instruments TI-84 User Manual

Page 443

background image

Chapter 16: Programming

440

While

While

While

While

While

performs a group of

commands

while

condition

is true.

condition

is frequently a

relational test (Chapter 2).

condition

is tested when

While

is encountered. If

condition

is true

(nonzero), the program executes a group of

commands

.

End

signifies the end of the group.

When

condition

is false (zero), the program executes each

command

following

End

.

While

instructions can be nested.

:While condition
:command (while condition is true)
:command (while condition is true)
:End
:
command

Repeat

Repeat

Repeat

Repeat

Repeat

repeats a group of

commands

until

condition

is true (nonzero). It is similar to

While

,

but

condition

is tested when

End

is encountered; therefore, the group of

commands

is

always executed at least once.

Repeat

instructions can be nested.

:Repeat condition
:command (until condition is true)

Program

Output