#Keywords and Operators
Last modified: 04 May 2026
#Hard Keywords
The following tokens are always interpreted as keywords and cannot be used as identifiers:
as- Used for type casts.
- Specifies an alias for an import.
as?is used for safe type casts.breakterminates the execution of a loop.classdeclares a class.continueproceeds to the next step of the nearest enclosing loop.dobegins ado/whileloop (a loop with a postcondition).elsedefines the branch of anifexpression that is executed when the condition is false.falsespecifies the 'false' value of the Boolean type.forbegins aforloop.fundeclares a function.ifbegins anifexpression.in- Specifies the object being iterated in a
forloop. - Used as an infix operator to check that a value belongs to a range, a collection, or another entity that defines a
containsmethod. - Used in
whenexpressions for the same purpose. - Marks a type parameter as contravariant.
!in- Used as an operator to check that a value does NOT belong to a range or collection.
- Used in
whenexpressions for the same purpose.
interfacedeclares an interface.is- Checks that a value has a certain type.
- Used in
whenexpressions for the same purpose.
!is- Checks that a value does NOT have a certain type.
- Used in
whenexpressions for the same purpose.
nullis a constant representing an object reference that doesn't point to any object.objectdeclares a class and its instance at the same time.packagespecifies the package for the current file.returnreturns from the nearest enclosing function or anonymous function.super- Refers to the superclass implementation of a method or property.
- Calls the superclass constructor from a secondary constructor.
this- Refers to the current receiver.
- Calls another constructor of the same class from a secondary constructor.
throwthrows an exception.truespecifies the 'true' value of the Boolean type.trybegins an exception-handling block.typealiasdeclares a type alias.typeofis reserved for future use.valdeclares a read-only property or local variable.vardeclares a mutable property or local variable.whenbegins awhenexpression (executes one of the given branches).whilebegins awhileloop (a loop with a precondition).
#Soft Keywords
The following tokens act as keywords in specific contexts but can be used as identifiers in others:
by- Delegates the implementation of an interface to another object.
- Delegates the implementation of the accessors for a property to another object.
catchbegins a block that handles a specific exception type.constructordeclares a primary or secondary constructor.delegateis used as an annotation use-site target.dynamicreferences a dynamic type in Kotlin/JS code.fieldis used as an annotation use-site target.fileis used as an annotation use-site target.finallybegins a block that is always executed when atryblock exits.get- Declares the getter of a property.
- Is used as an annotation use-site target.
importimports a declaration from another package into the current file.initbegins an initializer block.paramis used as an annotation use-site target.propertyis used as an annotation use-site target.receiveris used as an annotation use-site target.set- Declares the setter of a property.
- Is used as an annotation use-site target.
setparamis used as an annotation use-site target.valuewith theclasskeyword declares an inline class.wherespecifies the constraints for a generic type parameter.
#Modifier Keywords
These tokens act as keywords in modifier lists but can be used as identifiers elsewhere:
abstractmarks a class or member as abstract.actualdenotes a platform-specific implementation in multiplatform projects.annotationdeclares an annotation class.companiondeclares a companion object.constmarks a property as a compile-time constant.crossinlineforbids non-local returns in a lambda.datainstructs the compiler to generate canonical members for a class.enumdeclares an enumeration.expectmarks a declaration as platform-specific.externalmarks a declaration as implemented outside of Kotlin (JNI/JS).finalforbids overriding a member.infixallows calling a function using infix notation.inlinetells the compiler to inline a function and its lambdas.innerallows referring to an outer class instance from a nested class.internalmarks a declaration as visible in the current module.lateinitallows initializing a non-nullable property later.noinlineturns off inlining for a specific lambda.openallows subclassing or overriding.operatormarks a function as overloading an operator.outmarks a type parameter as covariant.overridemarks a member as an override.privatemarks visibility as private to the class or file.protectedmarks visibility as private to the class and subclasses.publicmarks visibility as global.reifiedmarks a type parameter as accessible at runtime.sealeddeclares a sealed class.suspendmarks a function or lambda as usable as a coroutine.tailrecmarks a function for tail-call optimization.varargallows passing a variable number of arguments.
#Special Identifiers
fieldis used inside a property accessor to refer to the backing field.itis used inside a lambda to refer to its parameter implicitly.
#Operators and Special Symbols
| Symbol | Description |
|---|---|
+, -, *, /, % | Mathematical operators (* is also for vararg spread) |
= | Assignment; also used for default parameter values |
+=, -=, *=, /=, %= | Augmented assignment operators |
++, -- | Increment and decrement operators |
&&, ` | |
==, != | Structural equality (calls equals()) |
===, !== | Referential equality |
<, >, <=, >= | Comparison operators (calls compareTo()) |
[, ] | Indexed access operator (calls get/set) |
!! | Assert non-null |
?. | Safe call operator |
?: | Elvis operator (null-coalescing) |
:: | Member or class reference |
.., ..< | Range creation |
: | Separates name from type in declarations |
? | Marks a type as nullable |
-> | Separates parameters/body in lambdas, function types, and when |
@ | Introduces annotations or references labels/scopes |
; | Statement separator |
$ | String template variable/expression reference |
_ | Unused parameter placeholder |