Match declarations

Report a typo

There is a set of declarations. Some of them are invalid.

a)

val language = "Kotlin"

b)

val language
language = "Kotlin"

c)

val version: Int = "the newest one"

d)

val language: String
language = "Kotlin"

Match these declarations with their descriptions.

Tip: Type inference is a mechanism that automatically determines the type of variables. It works when you do not set the variable type manually.

Match the items from left and right columns
a
b
c
d
Valid declaration without type inference
Invalid declaration, the variable doesn't have a type
Invalid declaration with type mismatch
Valid declaration with type inference
___

Create a free account to access the full topic