Button setter (Kotlin) not accepted | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Button setter (Kotlin) not accepted

why is it wrong? it looks just like the example solution https://sololearn.com/coach/1143/?ref=app https://code.sololearn.com/ccJS1hOdo3Pw/?ref=app

4th Dec 2022, 7:26 AM
alepou
alepou - avatar
4 Answers
+ 2
Ok so inside your setter block, the 'field' refers to the current value of the property (or the property itself), and 'value' is what you want to change it to. In your condition you need to validate the value, not the field! if (value>50)
4th Dec 2022, 11:07 AM
Tibor Santa
Tibor Santa - avatar
+ 1
Tibor Santa i can’t believe i missed that… thanks!
4th Dec 2022, 11:38 AM
alepou
alepou - avatar
0
If you actually show us your code, we can review.
4th Dec 2022, 9:38 AM
Tibor Santa
Tibor Santa - avatar
0
Tibor Santa sorry i thought the link was to my code
4th Dec 2022, 10:39 AM
alepou
alepou - avatar