https://kotlinlang.org logo
#announcements
Title
# announcements
b

bj0

12/08/2016, 9:45 PM
seems to depend on scope, this works:
Copy code
fun main(args: Array<String>) {
    val adHoc = object {
    	var y = 5
        fun z() = 3
	}
    
    println(adHoc.y)
    println(adHoc.z())
}
but this doesnt:
Copy code
fun main(args: Array<String>) {   
    println(adHoc.x + adHoc.y)
}

val adHoc = object {
    var x: Int = 0
    var y: Int = 0
}