This is a quick overview of expressions in Kotlin.
Atomic expressions
Atomic expressions are
- Literal constants (see Basic types, Strings)
- Tuple literals
- Variable names or field references
- Object expressions
- Parenthesized expression
- Control structures (if, when, try)
- Function literals
- this expressions
- break, continue or return
- note that these are expressions that are typed with the type Nothing
See the grammar for atomic expressions.
Operators
The grammar defines a number of operators denoted by symbols. The precedence table is available here. Many of the operators can be overloaded, other are described below:
- . – for member access
- ?. and ?: – for Null-safety
- && and || – for incomplete boolean evaluation
What's next
Labels:
None
Page:
Basic operations
Page:
Control structures
Page:
Function literals
Page:
Ranges
Page:
Returns and jumps
Page:
This expressions
Page:
Tuples
Page:
Type casts
