3 ms·
Because yield is implemented as a callback, there is no compiler magic to automatically stop the iteration when the caller side uses break or continue, so this
by Seb-C 2y ago
Because yield is implemented as a callback, there is no compiler magic to automatically stop the iteration when the caller side uses break or continue, so this condition cannot really be avoided.
Also there are many cases where you might need to have some special logic after the last iteration, so simply killing the underlying function is not an option.