I have a question about accessing the it in the outer loop in kotlin. I am trying to see how many letters differ between two strings. I would like to know is there a way to access the outer for loop with it?
fun compute (stringOne: String, stringTwo: String): Int {
var i = 0
stringOne.toCharArray().forEach @loop{
stringTwo.toCharArray().forEach {
if (it@loop.equals(it))
i++
}
}
return i
}
Run Code Online (Sandbox Code Playgroud)