Good day! Help, please, deal with the problem.
Error output:
Operator ‘==’ cannot be applied to ‘String?’ and ‘Int’
Code:
fun main() {
println("Rock-paper-scissors on kotlin!")
println("1 - rock, 2 - scissors, 3 - paper")
print("Your choice:")
val stringInput = readLine()
val compInput = (1..3).random()
if(stringInput == 3 && compInput == 1){
println("Computer wins!")
}
}
>Solution :
The number 3 and the string "3" are not the same thing.
Maybe you should replace it with stringInput == "3"