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 FALSE otherwise.

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, whereas A==5 is an expression which evaluates to TRUE if the variable A has the value 5, and does not change the value of A.

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, "5">"10" and "a">"Z" both evaluate to TRUE.

Either "=<" or "=>" makes Syntax Error.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.