Join Slack
So, what is the Kotlin terminology for the this code block? When you create an object and pass in a ...
# getting-started
k
Keith Miller
01/20/2024, 3:50 AM
So, what is the Kotlin terminology for the this code block? When you create an object and pass in a generic curly brace object with parameters set?
Untitled.kt
j
Joffrey
01/20/2024, 12:11 PM
This is just a regular object declaration as far as Kotlin is concerned. It just so happens that
MyObject
in your specific case is a class that takes a constructor parameter of a function type, and that function has a receiver which has this
name
property. There is no special language feature involved
2
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by