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.
HUNTER Basic understands four kinds of function:
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.
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 |
Operator | Remarks |
---|---|
= | Equality or assignment of values |
<> | Not equal to |
+ | String addition or concatenation |
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 |
X | NOT X |
---|---|
T | F |
F | T |
X | Y | X AND Y |
---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | F |
X | Y | X OR Y |
---|---|---|
T | T | T |
T | F | T |
F | T | T |
F | F | F |
X | Y | X XOR Y |
---|---|---|
T | T | F |
T | F | T |
F | T | T |
F | F | F |
X | Y | X EQV Y |
---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | T |
X | Y | X IMP Y |
---|---|---|
T | T | T |
T | F | F |
F | T | T |
F | F | T |
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:
10 = 0000000000001010
6 = 0000000000000110
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 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.