Seaskyways Seaskyways - 1 year ago 73
Java Question

Define multiple variables at once in Kotlin (e.g Java : String x,y,z;)

I was wondering if there is any way to define multiple variables in Kotlin at once like in Java and almost every other existing language in the world .

like in Java :

String x="Hello World!",y=null,z;

Answer Source

This is not possible in Kotlin language.

Please refer to this question and answer, where JetBrains' Engineer yole states that:

"Declaring multiple properties on the same line is frowned upon by many Java style guides, so we did not implement support for that in Kotlin."

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download