FANDOM


Syntax

IF statement THEN instructionlist ELSE instructionlist

Explanation

ELSE runs its input if the conditional statement which precedes it is FALSE. ELSE is used in conjuction with IF. See also IF and THEN.

Examples

The following procedure lets you guess the animal you supply as input.

TO GUESS :ANIMAL

PR [WHAT ANIMAL AM I THINKING OF?]

MAKE "CHOICE FIRST READLIST

IF :ANIMAL = :CHOICE THEN PR[CORRECT ANSWER] GUESS :ANIMAL

END

? GUESS "CAT

WHAT ANIMAL AM I THINKING OF?

? DOG

TRY AGAIN

? CAT

CORRECT ANSWER

?