Kotlin's Type Inference

Understand Kotlin's powerful type inference capabilities and how to use them to write more succinct code.

Type inference is a compiler feature that allows you to omit types in your code when the compiler can infer it for you.

Type Inference in Kotlin

Kotlin’s compiler can infer the types of most variables, so adding the type is optional:

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy