Another Delegates function is vetoable(). This also accepts a lambda
expression, one that also takes a KProperty along with old and new
values. This time, the return value of the lambda expression needs to be
a Boolean, where true means "accept this change" and false means
"reject this change". If false is returned, the property value will
not be changed. So, in this example, we only accept even values, so
setting the property to 5 quietly fails.
You can learn more about this in:
Tags: