August 2018
Beginner
178 pages
4h 56m
English
This delegate property is similar to lateinit properties. It allows a property to be declared without an initial value. If the value hasn’t been set yet and you try to read it, an exception is thrown:
var notNull by Delegates.notNull<Int>()
The value hasn't been set yet and if we try to read it, an exception will be thrown:
//this results in exceptionval n = notNull
We have to assign a value to the property first:
notNull = 1val num = notNull
Read now
Unlock full access