Not-equal

From BeebWiki
Jump to: navigation, search

Not-equal, <>, is an inequality operator to test whether two values are unequal.

<>
Availability Present in all original versions of BBC BASIC.
Syntax BASIC I-V <num-var> = <numeric> <> <numeric>
<num-var> = <string> <> <string>
Token (hex) BASIC I-V 3C 3E (operator)
Description BASIC I-V Compares the values of the two operands and returns TRUE if they are unequal, and FALSE otherwise.
Associated keywords =, <, >, <=, >=

Description

<> evaluates the expressions on either side, and compares their values. If the values are unequal (i.e. not equal), it returns the Boolean value TRUE, otherwise it returns FALSE. It is usually used as the condition of an IF statement, but it is equally valid to assign the result to a variable.

It is not possible to daisy-chain (in)equality tests (for example IF bool% <> X = Y THEN ...), as the Group 5 operators do not associate. Please see = for more details.

-- beardo 23:29, 13 June 2007 (BST)