https://kotlinlang.org logo
Title
u

user

06/28/2022, 5:51 AM
How can I execute multiple instructions for a when condition in Kotlin? I am trying to execute multiple lines of execution for a when condition in Kotlin, without using an if-else statement. However, kotlin is complaining and returning an error. How can this be achieved? For example: when(studentAnswer2){ quizAnswer2 -> points+=25 quizAnswer2-1 -> points += 20 println("The answer $studentAnswer2 is within 1 point of $quizAnswer2") quizAnswer2+1 -> points += 20 println("The answer $studentAnswer2 is within 1 point of...