Why I can't apply value inside while loop?

The Kotlin team decided against it for a few reasons I think. In most cases it is just considered bad style and it also makes code harder to read. Yes your example is the one valid place where this kind of feature would be pretty handy, but they decided against it still, because only a small numbers of libraries would actually use something like this and it’s not worth adding an new feature to the language just for that.
Also there is a massive discussion about this here

1 Like