chansek
11/10/2018, 11:38 AMigor.wojda
11/10/2018, 11:48 AMval shift = 2
val add2 = fun (x: Int, y: Int): Int {
return x + y + shift
}
As I recall this is how variables val/var variables captured by lambda are stored:
val
- value is copied to anonymous class
var
- value is stored in anonymous class as a reference to class that holds valuechansek
11/10/2018, 12:03 PMigor.wojda
11/10/2018, 12:13 PMchansek
11/10/2018, 12:27 PMigor.wojda
11/10/2018, 3:58 PM