My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Romman Sabbir

2 likes

·

2.8K reads

2 comments

Kaouther Mefteh
Kaouther Mefteh
Dec 14, 2023

Hi there, thanks a lot this is very useful :) small note is lateinit does not work with primitive types, means this line lateinit var age: Int is not correct. on the other hand primitive types are used with lazy delegates

1
·
·1 reply
Romman Sabbir
Romman Sabbir
Author
·Dec 14, 2023

Thanks for the correction. Yes, you are right. lateinit cannot be used with primitive types. lateinit is designed for non-nullable types, and since primitive types like Int cannot be null, using lateinit with them is not allowed.

·