|
|
|
|
|
by pmontra
1114 days ago
|
|
This feature is not so bad: > In case you really need to vary a variable, the when keyword lets you check a variable each time it mutates. const var health = 10!
when (health = 0) {
print("You lose")!
}
If it can really be triggered when the variable changes to any value it makes it a truly reactive paradigm programming language. By the way, could that be hacked to implement loops? const var i = 10
when (i >= 0) {
do_something()
i = i - 1
}
|
|