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:

1
Q

actual

A

denotes a platform-specific implementation in multiplatform projects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

abstract

A

marks a class or member as abstract

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

annotation

A

declares an annotation class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

companion

A

declares a companion object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

const

A

marks a property as a compile-time constant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

crossinline

A

forbids non-local returns in a lambda passed to an inline function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

data

A

instructs the compiler to generate canonical members for a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

enum

A

declares an enumeration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

expect

A

marks a declaration as platform-specific, expecting an implementation in platform modules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

external

A

marks a declaration as implemented not in Kotlin (accessible through JNI or in JavaScript).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

final

A

forbids overriding a member

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

infix

A

allows calling a function in infix notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

inline

A

tells the compiler to inline the function and the lambdas passed to it at the call site

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

inner

A

allows referring to the outer class instance from a nested class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

internal

A

marks a declaration as visible in the current module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

lateinit

A

allows initializing a non-null property outside of a constructor

17
Q

noinline

A

turns off inlining of a lambda passed to an inline function

18
Q

open

A

allows subclassing a class or overriding a member

19
Q

operator

A

marks a function as overloading an operator or implementing a convention

20
Q

out

A

marks a type parameter as covariant

21
Q

override

A

marks a member as an override of a superclass member

22
Q

private

A

marks a declaration as visible in the current class or file

23
Q

protected

A

marks a declaration as visible in the current class and its subclasses

24
Q

public

A

marks a declaration as visible anywhere

25
Q

reified

A

marks a type parameter of an inline function as accessible at runtime

26
Q

sealed

A

declares a sealed class (a class with restricted subclassing)

27
Q

suspend

A

marks a function or lambda as suspending (usable as a coroutine)

28
Q

tailrec

A

marks a function as tail-recursive (allowing the compiler to replace recursion with iteration)

29
Q

vararg

A

allows passing a variable number of arguments for a parameter

30
Q

field

A

is used inside a property accessor to refer to the backing field of the property

31
Q

it

A

is used inside a lambda to refer to its parameter implicitly