There are six relational operators in Petit Computer BASIC, and they are:
They all take two operands (inputs or parameters); one before the operator and one after. The operators will yield a result of
TRUE if the relationships between the two operands are as indicated, and
Of particular significance is that the equality operator is represented by two 'equals' signs next to each other, not just one. A single "
=" symbol represents assignment. Thus,
A=5 is a command which assigns the value
5 to the variable
A==5 is an expression which evaluates to
TRUE if the variable
A has the value
5, and does not change the value of
Also worth noting is that all relational operators work on pairs of strings, too (though comparing a string to a number will result in a
Syntax error). One string is considered 'less than' a second if they are different, and the
ASC value of the first character that differs is less in the first string than it is in the second string. This does not always give a natural ordering, because, for instance,
"a">"Z" both evaluate to
"=>" makes Syntax Error.