I updated my Android Studio to the latest update HedgeHog. Whenever I run Kotlin File, I get this error : Operation is not supported for read-only collection.
I updated Kotlin Version too...
My Kotlin Version: 231-1.9.10-release-459-AS9392.1.2311.11076708 (The updated one) Kotlin Compiler Version: 1.9.21 Language Version: Latest Stable (1.9) API Version: Latest Stable (1.9)
I was expecting a proper run of the Kotlin File but there are no resources available online to get reference from for this issue.
This is the code for which I was working:
fun main() {
var computerChoice = ""
var playerChoice: String
println("Rock, Paper or Scissors? Enter your Choice: ")
playerChoice = readLine() ?: ""
val randomNumber = (1..3).random()
if (randomNumber == 1) {
computerChoice = "Rock"
} else if (randomNumber == 2) {
computerChoice = "Paper"
} else {
computerChoice = "Scissors"
}
println(computerChoice)
}
It worked for me when I restored to defaults.