This page is also available in 3 other languages

!=

[Comparison Operators]

Description

Compares the variable on the left with the value or variable on the right of the operator. Returns true when the two operands are not equal.

Syntax

x != y;   // is false if x is equal to y and it is true if x is not equal to y

Parameters

x: variable. Allowed data types: int, float, double, byte, short, long
y: variable or constant. Allowed data types: int, float, double, byte, short, long

Example Code

if (x!=y)      // tests if x is not equal to y
{
// do something only if the comparison result is true
}

See also