Last active
February 5, 2018 00:02
-
-
Save husaynhakeem/d9b665405a7577758a2ea66a441bd3cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var vetoableData: Int by Delegates.vetoable(0) { | |
| property, oldValue, newValue -> | |
| println("${property.name}: $oldValue -> $newValue") | |
| newValue >= 0 | |
| } | |
| fun main(args: Array<String>) { | |
| vetoableData = -1 | |
| println("vetoableData = $vetoableData") | |
| vetoableData = 1 | |
| println("vetoableData = $vetoableData") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment