kotlin keywords Flashcards Preview

Kotlin keywords > kotlin keywords > Flashcards

Flashcards in kotlin keywords Deck (30)
Loading flashcards...
1
Q

as

A
  • is used for type casts.

- specifies an alias for an import.

2
Q

as?

A

is used for safe type casts.

3
Q

break

A

terminates the execution of a loop.

4
Q

class

A

declares a class.

5
Q

continue

A

proceeds to the next step of the nearest enclosing loop.

6
Q

do

A

begins a do/while loop (loop with postcondition).

7
Q

else

A

defines the branch of an ‘if expression’ which is executed when the condition is false.

8
Q

false

A

specifies the ‘false value’ of the Boolean type.

9
Q

for

A

begins a “for loop”.

10
Q

fun

A

declares a function.

11
Q

if

A

begins an “if expression”.

12
Q

in

A
  • specifies the object being iterated in a ‘for loop’.
  • is used as an infix operator to check that a value belongs to ‘a range’, a collection or another entity that defines the ‘contains method.’
  • is used in ‘when expressions’ for the same purpose.
  • marks a type parameter as ‘contravariant’.
13
Q

!in

A
  • is used as an operator to check that a value does NOT belong to ‘a range’ , a collection or another entity that ‘defines the ‘contains method’.

is used in ‘when expressions’ for the same purpose.

14
Q

interface

A

declares an ‘interface’ .

15
Q

is

A
  • checks that ‘a value does NOT have a certain type’ .

- is used in ‘when expressions’ for the same purpose.

16
Q

null

A

is a constant representing an object reference that does not point to any object.

17
Q

object

A

declares ‘a class and its instance at the same time.

18
Q

package

A

specifies the ‘package for the current file’ .

19
Q

return

A

‘returns from the nearest enclosing function or anonymous function’ .

20
Q

super

A
  • ‘refers to the superclass implementation of a method or property’ .
  • ‘calls the superclass constructor from a secondary constructor’ .
21
Q

this

A
  • refers to the ‘current receiver’ .

- ‘calls another constructor of the same class from a secondary constructor’ .

22
Q

throw

A

‘throws an exception’ .

23
Q

true

A

specifies the ‘true’ value of the ‘Boolean Type’ .

24
Q

try

A

‘begins an exception handling block’ .

25
Q

typealias

A

declares ‘a type alias’ .

26
Q

typeof

A

reserved for future use.

27
Q

val

A

declares a read-only ‘property’ or ‘local variable’ .

28
Q

var

A

declares a mutable ‘property’ or ‘local variable’ .

29
Q

when

A

begins a ‘when expression’ (executes on of the given branches).

30
Q

while

A

begins a ‘while loop’ (loop with precondition).