If-then, If if 8, If-then if-then 8 – Texas Instruments TI-73 EXPLORER User Manual

Page 235: 1 and 2

Advertising
background image

Chapter 12: Programming

229

7312ENG.DOC CH 12 Programming, English Julie Hewlett Revised: 07/29/98 12:17 PM Printed: 05/19/99 9:02

AM Page 229 of 32

If

If 8

1

1

Use

If

to execute one command depending upon condition. If

condition is true (non-zero), then command1 is executed. If

condition is false (zero), then command1 is skipped.

If

instructions can be nested.

:If

condition

:

command1 (if true)

:

command2

Write a program named

COUNT

that adds one to variable A and

displays the current value until A‚2.

PROGRAM:COUNT

:0"A

:Lbl Z

:A+1"A

:Disp "A IS",A

:Pause

:If A‚2

:Stop

:Goto Z

If-Then

If-Then 8

1 and 2

1 and 2

Use

If

with

Then

to execute more than one command (block)

depending upon condition. If condition is true (non-zero),

then block is executed. If condition is false (zero), then block is

skipped.

End

identifies the end of the block. Both

Then

and

End

must be on a line by itself.

:If

condition

:

Then

:

block (if true)

:End

:

command

³

Press

b

.

Advertising