I'd like to write an anonymous lambda function in Kotlin, but it looks like it doesn't take the argument passed to it. (It is not passed at all, since the IDE hints that "variable 'name' is never used".)
Code:
var name = "Tobias Boon"
println("reverse=" + fun(name: String): String {
var t: String = ""
for(i in name.indices.last downTo 1) {
t += text.subSequence(i - 1, i)
}
return t
})
Currently prints: reverse=(kotlin.String) -> kotlin.String
println(name.reversed())