0
Declare var in kotlin without initializing
I have issue in kotlin when declaring a var without initialization like this (var num :Double) , how to define a var of any type without initializing it help me pls I need solution
2 Respuestas
+ 2
I'm not sure what issue you have. Are you looking for something like this?
var num = 0 // Int
var num = 0.0 // Double
var num = '' // Char
var num = "" // String
+ 2
tetsuya ,
this should work:
fun main(args: Array<String>) {
var name: String
//other code ...
name = "tom"
// other code ...
println(name)
}