# Syntax¶

The functions described in this manual follow the conventions set out below. For all Basic statements and commands the syntax must be correct for the program to run successfully.

Basic reserved words are printed in uppercase, but they may be entered into HUNTER as either uppercase or lowercase or a combination of both. Either way, the interpreter will convert them to uppercase.

Items not in square brackets are essential arguments to the Basic function and must be included.

Square brackets indicate that the item is optional.

Punctuation must be included where shown.

## Description Of Functions¶

HUNTER Basic understands four kinds of function:

Commands

Statements

Operators

Functions

**Commands** generally initiate an action and can also control execution
of application programs.

**Statements** form the structure of application programs and direct
program flow.

**Operators** are used to relate data and to test for specified
conditions.

**Functions** perform arithmetic or string computations.

Some commands and statements will function without further information, others require an argument. An argument is either a value, an expression or another function.

A complete list of functions is given in Basic Functions.

## Expressions And Operators¶

### Symbolic Operators For Use With Numerical Variables¶

Operator |
Remarks |
---|---|

= |
Equality or assignment of values |

+ |
Addition |

- |
Subtraction or negation of value |

* |
Multiplication |

^ or ** |
Powers |

/ |
Division |

( |
Open parenthesis |

) |
Closed parenthesis |

=> |
Equal to or greater than |

=< |
Equal to or less than |

< |
Less than |

> |
Greater than |

<> |
Not equal to |

### Operators For Use With String Variables¶

Operator |
Remarks |
---|---|

= |
Equality or assignment of values |

<> |
Not equal to |

+ |
String addition or concatenation |

### Logical Operators¶

Logical operators perform logical or Boolean operations on numeric values:

Operator |
Remarks |
---|---|

NOT |
logical complement |

AND |
conjunction |

OR |
disjunction |

XOR |
exclusive OR |

EQV |
equivalence |

IMP |
implication |

#### Truth Tables¶

##### NOT¶

X |
NOT X |
---|---|

T |
F |

F |
T |

##### AND¶

X |
Y |
X AND Y |
---|---|---|

T |
T |
T |

T |
F |
F |

F |
T |
F |

F |
F |
F |

##### OR¶

X |
Y |
X OR Y |
---|---|---|

T |
T |
T |

T |
F |
T |

F |
T |
T |

F |
F |
F |

##### XOR¶

X |
Y |
X XOR Y |
---|---|---|

T |
T |
F |

T |
F |
T |

F |
T |
T |

F |
F |
F |

##### EQV¶

X |
Y |
X EQV Y |
---|---|---|

T |
T |
T |

T |
F |
F |

F |
T |
F |

F |
F |
T |

##### IMP¶

X |
Y |
X IMP Y |
---|---|---|

T |
T |
T |

T |
F |
F |

F |
T |
T |

F |
F |
T |

## Logical Operations¶

Logical operators act upon the binary equivalents of decimal arguments, bit by bit, where the argument is a 16 bit signed 2’s complement number i.e. in the range -32768 to +32767. For example:

```
PRINT 10 AND 6
```

will print 2, since:

Performing the AND operation bit by bit, only one bit remains non zero. See the AND truth table in above for further details.

Logical operations may also be used by conditional statements, for example:

```
IF A=B AND B=C THEN PRINT"ALL EQUAL"
```

In this example the following occurs:

The variables A,B are tested for equality. If they are equal then a true (-1) condition is returned, if not then a false (0) is returned.

The variables B,C are tested for equality. The results are as in (1) above.

The logical operation AND in then performed on the results of (1) and (2) above, which returns either a true (-1) or false (0) result. It is this final result upon which the IF statement performs its conditional test (true or false). Since conditional statements always produce a logical result it is possible in some circumstances to omit a relational operator. For example:

IF A<>0 THEN PRINT"A IS NON ZERO"

may be replaced with:

IF A THEN PRINT"A IS NON ZERO”

or

IF A=5 THEN PRINT -1 ELSE PRINT 0

may be replaced with:

PRINT A=5

since A and 5 are tested for equality and if they are equal the -1 (true) is printed otherwise 0 (false) is printed.