Hi guys, I have a question regarding properties vs...
# getting-started
f
Hi guys, I have a question regarding properties vs parameters in Kotlin. I use KDoc and have something like this:
Copy code
/**
 * @property name ...
 */
class Person(private val name: String)
KDoc doesn't generate this. Only if I change property to param. Reading the linked SO thread it appears to actually be a property though. Can someone clarify please? https://stackoverflow.com/questions/45032436/what-is-the-difference-between-properties-and-parameters-in-kotlin
h
It's both. The explanation on SO is correct – it's a shorthand for declaring a constructor parameter and a property and assigning the property the value of the parameter.
👍 1
f
So it's probably just a quirk of KDoc/dokka ?
h
I have never used KDoc, so I don't really know – but if I had to guess I'd say it's because of the
private
. It doesn't really make sense to include private properties in the public documentation.
The parameter on the other hand is on the public constructor…