Search⌘ K
AI Features

Operators: Unary, Increment, and Decrement

Explore unary operators in Kotlin, such as plus, minus, and logical not, and understand how increment and decrement operators modify values efficiently. Learn how to use pre- and post-increment/decrement, and discover operator overloading to extend these operations for custom object behavior to make your code more readable and functional.

Unary prefix operators

A +, -, or ! in front of a single value is also an operator. Operators that are used with only a single value are called unary operators. ...