4 ms·
The "Expanded Parameters blocks" is kind of supported in Kotlin. You can write a function like this: /** * @param arg the string to garble */
by MrBuddyCasino 4y ago
The "Expanded Parameters blocks" is kind of supported in Kotlin. You can write a function like this:
/**
* @param arg the string to garble
*/
fun doThing(@NotEmpty arg: String = "default)
In this example, "arg" is mandatory, or else it would have the type "String?", making it nullable. It obviously has a default value. It has an annotation that performs some validation, though admittedly that is a library and not a language feature. And it has its own documentation. I find this more concise than the Powershell example.
- still_grokking 4y agoAs with almost all "Kotlin features" this is a direct rip off from Scala, where the signature would look almost identical (besides the fun keyword).