Does Kotlin always use reference while capturing l...
# getting-started
s
Does Kotlin always use reference while capturing local variables? I looked at the generated java count and an IntRef is being used and that explains why lambda is able to see the latest values. ( testLambda basically starts another thread and executes provided lambda in a loop ) var mainCount = 0 testLambda { println( "Count is $mainCount" ) } thread { while( true ) { mainCount++ Thread.sleep( 1000 ) } }