>

[Comparison Operators]

Description

Compares the variable on the left with the value or variable on the right of the operator. Returns true when the operand on the left is greater (bigger) than the operand on the right.

Syntax

x > y;   // is true if x is bigger than y and it is false if x is equal or smaller than 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 greater (bigger) than y
{
// do something only if the comparison result is true
}

Notes and Warnings

Positive numbers are greater than negative numbers.

See also