Sign in Go Pro


Delegation by Using the lateinit Modifier


Up next


Course Retired

The Introduction to Kotlin course has been retired and replaced with the very comprehensive Kotlin Programming Language course.


In Kotlin we need to initialize a variable or mark it as null which is not mostly convenient because then we need to add null checks every time we use the variable.

That's where lateinit modifier comes in, it gives guarantee to the compiler that the variable will be initialized at the later stage and tells compiler to relax on Null Safety.

In this lesson you will learn:

  • How to use lateinit modifier
  • Verify the behavior of lateinit
  • Check what happens if lateinit variable is not initialized at later stage




There are no comments on this lesson, start the conversation below ...

You need to go PRO to post comments.

Lessons in Kotlin