I'm doing a palindrome exercise and want to verify half of the string in a loop. I tried to do for ex: for(index in text.indices / 2) and didn't work
fun palindrome(text:String): Boolean {
var inverse : Int = text.length - 1
for (index in text.indices) {
if (!text[index].equals(text[inverse])) {
return false
}
inverse--
}
return true
}