<Kotlin: can I get an object inside an object usin...
# stackoverflow
r
Kotlin: can I get an object inside an object using variable whose value is the name of an object? The title is probably confusing, but I didn't know how to explain it better. Usually I use javascript, and in it you can have this: var objectVar = "myOtherVariable"; var someObject = { myVariable: "something", myOtherVariable: "something else" } // writes out 'something else' console.log(someObject[objectVar]) Is it possible to do something like this in kotlin? For instance, if you have val myVar = "a" object someObject{ var a: MutableSet = mutableSetOf() var b: MutableSet...