I have the following code in PHP public static $bitValueTable = null;
and I want to convert it into Kotlin. My variable is a null array in the first step but I add some value after the program runs.
how can I convert?
In kotlin you can use nullable objects with the secure call operator "?".
Now, you have a static variable in PHP, in kotlin there is no "static" as such, however the companion object {} fulfills the same function.
In this way the equivalent of public static $bitValueTable = null;
in kotlin is:
companion object {
var bitValueTable : Array<Type>? = null
}
Obs: