Issue
I've just started learning the basics of the Kotlin to create Android apps. I don't understand why I cannot run my program even though I'm following a tutorial.
Here's my code:
fun main() {
var x: int = 3
println("value of x is $x")
}
When I try to compile it, I get this error:
Unresolved reference: int
Solution
Use Int
instead of int
All of the basic types in Kotlin start with a capital letter. This is different from Java, which has primitive types that start with a lowercase letter. You should replace int
with Int
.
Answered By - Sam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.