Hello i tried to write a hangman game in kotlin but when i click button application crashes. It might be bad kotlin syntax or something. Logcat tells me that it's error in this function
private fun showLetter(char: Char) {
val tv = tvWord.text.toString().toCharArray()
for (i in tv.indices) {
if (keyWord[i] == char) tv[i] = char
}
tvWord.text = String(tv)
}
At this line
if (keyWord[i] == char) tv[i] = char