BASIC FUNCTIONS
SECTION 5.10
5. 10.1
Function IF selectively executes program statements dependant on
result of an expression.
Syntax IF A(op)B THEN C
Where A is an expression, variable or constant and (op) is
an operator =,
< , > etc. The operator may be logical or
omitted. See section
4.2.3, LOGICAL OPERATIONS, for
further details.
Bis an expression, variable or constant
C is either a line number or program statement.
Examples IF A= B THEN 100
IF A>B THEN PRINT
11
N0
11
C may be a multiple statement which will be entirely
executed if the condition is true, but skipped if not.
HUNTER also permits nesting of
IF statements.
Example:
IF A= B THEN IF C=D THEN PRIITT
11
FINISHED
11
:GOTO 1000
String expressions may be tested for equality or
unequaiity,· for example:
IF A$+ B$ =
11
ABCDEAFl" THEN 100
or
IF A=B AND B=C OR D=5 THEN PRINT"TRUE"
In this example "TRUE" may be printed by one of two methods
allowed by the OR operator as follows:
1 ) if A=B=C
2) if D=5
VEE.V09F
PAGE 5 - 42