Property getter and setter is expected

when I try to declare the variable mobile number and password, i am getting the error - Type expected and property getter or setter expected

i am new to kotlin and andriod dev please help me , i have attached my code here


Try

val validMobileNumber = "766…"

or

val validMobileNumber: String = "766…"

: is for specifying a type and = for assignment. In this case the type is optional because it can be inferred from the assigned value.

Your eyesight and window/monitor size may let you read those images easily, but please think of those who can’t (along with those who might be reading on a tablet or phone, those who might be using a screen reader, those who might want to find this page via a search engine, those who might be reading this in future when the images are no longer available, those who might want to copy-and-paste the code to run themselves, or several other reasons) and consider posting the code as text.

2 Likes