Hi, I currently follow the new course "Android Kot...
# android
j
Hi, I currently follow the new course "Android Kotlin Fundamentals", I'm at the chapter 05.2: LiveData and LiveData observers, and i have a question about this chunk of code:
score.value = (score.value)?.minus(1)
why the parentheses ? isn't the exact same thing that:
score.value = score.value?.minus(1)
(score isn't nullable)
l
if
score
is not nullable, and
value
is, those 2 are the same
j
Ok thanks. Is there some situation where the parentheses means something special ?
l
Maybe during a cast?
(val myClass as? MySecondClass)?.secondClassMethod()
j
thanks 🙂
Strange that there are put parentheses here in this codelabs 🙂
l
Maybe for better understandability or readability 🙂
👍 1