Sonu Sanjeev
08/08/2021, 4:07 AMvar isRectangle: Boolean
get() = field
set(value) = value.not() // The error is here
How is it possible to return a Unit type when we use a syntax like "set(value) = " . Thanks in Adavanceephemient
08/08/2021, 4:20 AMephemient
08/08/2021, 4:21 AMisRectangle = true or isRectangle = false?Sonu Sanjeev
08/08/2021, 4:24 AMset(value) = throw Exception("")ephemient
08/08/2021, 4:25 AMset(value) { field = value }Sonu Sanjeev
08/08/2021, 4:26 AMephemient
08/08/2021, 4:26 AMSonu Sanjeev
08/08/2021, 4:26 AMephemient
08/08/2021, 4:27 AMisRectangle get() to return false? how could that work?James Whitehead
08/08/2021, 4:27 AMephemient
08/08/2021, 4:28 AMJames Whitehead
08/08/2021, 4:28 AMephemient
08/08/2021, 4:29 AMwidth and height, do you expect setting it to somehow change width and height to "correct" the computed value of isRectangle?Sonu Sanjeev
08/08/2021, 4:31 AMset(value) {
field = value.not()
}
using "set(value) = " style.Sonu Sanjeev
08/08/2021, 4:32 AMSonu Sanjeev
08/08/2021, 4:34 AMSonu Sanjeev
08/08/2021, 4:35 AMset(value) = throw Exception("Cannot set value")James Whitehead
08/08/2021, 4:36 AMJames Whitehead
08/08/2021, 4:37 AMval insteadephemient
08/08/2021, 4:37 AMval (only getter) instead of throwing an exception in the setter.Sonu Sanjeev
08/08/2021, 4:40 AM