Skip to main content

= (Equality)

Syntax

expressionLEFTexpressionRT

Description

The = (Equality) Operator evaluates two expressions, compares them for equality and returns the resulting condition. The condition is false (0) if the left-hand side expression and the right-hand side expression are unequal, or true (1) if they are equal.

Example

Equality comparisons should not be confused with  Assignments, both of which also use the "=" symbol:

i = 420 '' assignment: assign the value of i as 420

IF( i = 69 ) THEN '' equation: compare the equality of the value of i and 69

PRINT "serious error: i should equal 420"

END
ENDIF

...

The <> (Inequality) Operator is complement to the = (Equality) Operator, and is functionally identical when combined with the NOT (Bit-wise Complement) Operator:

IF( 420 = 420 ) THEN PRINT "( 420 = 420 ) is true."

IF NOT( 69 <> 69 ) THEN PRINT "not( 69 <> 69 ) is true."

Differences from other BASICs

  • none

See also