TEST

Syntax

TEST statement

Explanation

TEST determines whether its input is TRUE or FALSE and remembers it for later use in an IFTRUE or IFFALSE statement.

Example

TO GUESSNUM


 * MAKE "NUM RANDOM 10


 * PR [I'M THINKING OF A NUMBER BETWEEN 1 AND 10.]


 * LABEL "LOOP


 * TYPE [CAN YOU GUESS IT]


 * MAKE "GUESS READ


 * TEST (:NUM = :GUESS)


 * IFTRUE [PR [GOOD GUESS!] STOP]


 * IFFALSE [PR [NO, TRY AGAIN.]]


 * GO "LOOP

END

? GUESSNUM

I'M THINKING OF A NUMBER BETWEEN 1 AND 10.

CAN YOU GUESS IT? 3

NO TRY AGAIN.

CAN YOU GUESS IT? 7

GOOD GUESS!

?