Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Questiion about the principle of Unit Kotlin

I am new to Kotlin and I have question as I dont fully understand the principle of Unit:

onChecked:(Boolean) -> Unit

Does it pass the certain data as parameter to other function ( as a Unit)?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

(Boolean) -> Unit is a function type. Before the arrow are the parameters, in this case a Boolean and after the arrow is the return type. Unit simply means that it doesn’t return anything.

See also this documentation

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading