# Kotlin Comparison Operators

## Kotlin Comparison Operators

Kotlin Comparison Operators are used to compare given two values. Like if one value is greater than, less than, equal to, greater than or equal to, or less than or equal to of another value.

In this tutorial, we shall learn about Comparison Operators, their symbols, and how to use them in Kotlin programs with help of examples.

## Table for Comparison Operators

The following table covers Comparison Operators in Kotlin.

## Example Kotlin Program for Comparison Operators

In the following program, we take two numbers: `a`, and `b`; and perform comparison operations on these numbers.

Kotlin Program

``````fun main() {
var x = 5
var y = 2

println("x = \$x\ny = \$y")

var result: Boolean

// Equal-to
result = x == y
println("x == y   \$result")

// Not-equal
result = x != y
println("x != y   \$result")

// Greater-than
result = x > y
println("x > y    \$result")

// Less-than
result = x < y
println("x < y    \$result")

// Greater-than or Equal-to
result = x >= y
println("x >= y   \$result")

// Less-than or Equal-to
result = x <= y
println("x <= y   \$result")
}``````

Output

``````x = 5
y = 2
x == y   false
x != y   true
x > y    true
x < y    false
x >= y   true
x <= y   false``````

## Comparison Operators Tutorials

The following tutorials cover Comparison Operators in detail.