Modifier Keywords & Special Identifiers Flashcards
The following tokens act as keywords in modifier lists of declarations and can be used as identifiers in other contexts: Special identifiers (field & it) are defined by the compiler in specific contexts and can be used as regular identifiers in other contexts:
actual
denotes a platform-specific implementation in multiplatform projects
abstract
marks a class or member as abstract
annotation
declares an annotation class
companion
declares a companion object
const
marks a property as a compile-time constant
crossinline
forbids non-local returns in a lambda passed to an inline function
data
instructs the compiler to generate canonical members for a class
enum
declares an enumeration
expect
marks a declaration as platform-specific, expecting an implementation in platform modules
external
marks a declaration as implemented not in Kotlin (accessible through JNI or in JavaScript).
final
forbids overriding a member
infix
allows calling a function in infix notation
inline
tells the compiler to inline the function and the lambdas passed to it at the call site
inner
allows referring to the outer class instance from a nested class
internal
marks a declaration as visible in the current module