What's wrong with the code (besides the string literal)? When I take Android Studio's suggestion to convert assignment to assignment expression, it converts the code to this monstrosity:
"Press".also { rollButton.text = it }
The other suggestion is to add method contract to
setText
.
FTR, I found out elsewhere that the underline just means that
text
is a
var
, not that anything is the matter.
g
gildor
01/11/2021, 3:52 AM
underscore it’s standard syntax highlighting in kotlin for mutable variables, properties
The goal of it not only show that it mutable, but partially discurage it
✔️ 1
about “apply” block, it’s not a suggestion, it’s called “quickfix”, it’s just a context action available for this line of code, for example if you press Alt+Enter on forEach you will see “replace with for loop”, so it’s not really a suggestion, but some shortcuts for common idioms