Operators are used to perform operations on variables and values. Kotlin divides operators into several groups.
Arithmetic operators are used to perform common mathematical operations.
+ (Addition): Adds together two values.- (Subtraction): Subtracts one value from another.* (Multiplication): Multiplies two values./ (Division): Divides one value by another.% (Modulus): Returns the division remainder.++ (Increment): Increases the value of a variable by 1.-- (Decrement): Decreases the value of a variable by 1.Assignment operators are used to assign values to variables. The most common is the = operator.
You can combine assignment with arithmetic operations (e.g., x += 5 is the same as x = x + 5).
Comparison operators are used to compare two values and return a Boolean (true or false). These are vital for conditional statements.
== (Equal to)!= (Not equal)>, <, >=, <= (Greater than, Less than, etc.)