Alex
11/10/2022, 9:18 AMval nameList:List<String>=listOf("Apple","Orange","Pear")
->> CODE A
2. I get the following error below "Property getter or setter expected"
3. i had to write as following val nameList=listOf<String>("Apple","Orange","Pear")
which is fine with me, but why cant i use Code A, hope someone can advise meKlitos Kyriacou
11/10/2022, 9:36 AM>=
to mean greater than or equal to. The Kotlin coding conventions recommend that you should write it like this:
val nameList : List<String> = listOf("Apple", "Orange", "Pear")
Following conventions makes it easier for others to understand your code.Alex
11/10/2022, 9:39 AM