Beginner 7 min readKotlin 2.0

Kotlin Operators โ€” Arithmetic, Comparison, and Logical

Operators are symbols that perform operations on values. Kotlin supports arithmetic, comparison, logical, bitwise, and assignment operators.

What You Will Learn

  • Arithmetic operators: +, -, *, /, %
  • Comparison operators: ==, !=, <, >, <=, >=
  • Logical operators: &&, ||, !
  • Assignment operators: +=, -=, *=, /=
  • Increment and decrement: ++, --

Arithmetic Operators

Perform math operations on numbers.

Arithmetic

kotlin
fun main() {
    val a = 10
    val b = 3
    println(a + b)   // 13
    println(a - b)   // 7
    println(a * b)   // 30
    println(a / b)   // 3 (integer division)
    println(a % b)   // 1 (remainder)
    println(10.0 / 3) // 3.333...
}
Output
13 7 30 3 1 3.3333333333333335

Integer division truncates the result. 10 / 3 = 3, not 3.33. Use Double for decimal division.

Beginner Tip: Use % (modulo) to check if a number is even or odd: if (n % 2 == 0) it is even.

Comparison Operators

Return Boolean values by comparing two values.

Comparison

kotlin
fun main() {
    val x = 10
    val y = 20
    println(x == y)   // equal
    println(x != y)   // not equal
    println(x < y)    // less than
    println(x > y)    // greater than
    println(x <= 10)  // less than or equal
    println(x >= 10)  // greater than or equal
}
Output
false true true false true true

== compares values (structural equality). In Kotlin, == is equivalent to .equals() for objects.

Logical Operators

Combine boolean conditions.

Logical Operators

kotlin
fun main() {
    val a = true
    val b = false
    println(a && b)   // AND
    println(a || b)   // OR
    println(!a)       // NOT

    val age = 25
    val hasId = true
    println(age >= 18 && hasId)  // both must be true
}
Output
false true false true

&& requires both sides true. || requires at least one side true. ! inverts a boolean. Kotlin uses short-circuit evaluation โ€” the second operand is only evaluated if needed.

Assignment and Increment

Update variables concisely.

Assignment Operators

kotlin
fun main() {
    var n = 10
    n += 5;  println(n)   // 15
    n -= 3;  println(n)   // 12
    n *= 2;  println(n)   // 24
    n /= 4;  println(n)   // 6
    n++; println(n)       // 7
    n--; println(n)       // 6
}
Output
15 12 24 6 7 6

+= adds and assigns. *= multiplies and assigns. n++ increments by 1. n-- decrements by 1.

Practice Exercise

Exercisepredict output

What prints? val x = 7 println(x % 3) println(x > 5 && x < 10)

Quick Quiz

Quick Quiz

What is the result of 10 / 3 in Kotlin when both operands are Int?

Frequently Asked Questions

Related Tutorials

Last updated: 2026-05-01Kotlin 2.0

Written by KotlinGuide Editorial Team ยท Reviewed by KotlinGuide Technical Review