Kotlin Operators


Kotlin Operators – The Smart Tools

In Kotlin, operators are symbols that help perform calculations, logic, or even comparison between values. Think of them as tiny tools that do specific tasks.


1. Arithmetic Operators – For Math Magic

These are used when you need to do math:

Symbol Meaning Example
+ Add val sum = 10 + 5
- Subtract val diff = 10 - 3
* Multiply val prod = 4 * 5
/ Divide val div = 10 / 2
% Remainder (mod) val mod = 9 % 4

2. Assignment Operators – Set & Update Values

These are used to store or modify data inside variables:

Symbol Meaning Example
= Set value val a = 10
+= Add and assign a += 5 → a = a + 5
-= Subtract and assign a -= 3
*= Multiply and assign a *= 2
/= Divide and assign a /= 4
%= Mod and assign a %= 6
These are shortcuts for changing existing values.

3. Comparison Operators – Check Relationship

Used to compare two values, usually in conditions.

Symbol Meaning Example
=#ERR520! Equal to a == b
!= Not equal a != b
> Greater than a > b
< Less than a < b
>= Greater or equal a >= b
<= Less or equal a <= b
Returns true or false.

4. Logical Operators – Combine Truth Checks

Perfect when dealing with multiple conditions.

Symbol Name Example Means
` ` OR
! NOT !(a > 5) Reverses the result
Useful in decision-making (if, while, etc).

Prefer Learning by Watching?

Watch these YouTube tutorials to understand KOTLIN Tutorial visually:

What You'll Learn:
  • 📌 #9 Kotlin Tutorial | Operators
  • 📌 4# Kotlin Operators Tutorial | Arithmetic & Relational Operators Kotlin
Previous Next