+ 3
Почему код не работает?
Код: fun main(args: Array<String>) { var name = readLine() if (name = Artem) { println("You are the best!") } else { println("You are not Artem :(") } } Выводит ошибку, что делать? https://code.sololearn.com/cKPjrLNCFOKx/?ref=app
2 Answers
+ 4
if (name = Artem)
2 mistakes:
- use == to compare for equality
- put the string value inside quotes
Correct code:
if (name == "Artem")
+ 3
Tibor Santa yup, now it's working. Thanks a lot!