3 ms·
There are languages that tried to make these kinds of loops a bit more explicit, like Ada with the reverse keyword, and the whole named loop/block which used wi
by touisteur 3y ago
There are languages that tried to make these kinds of loops a bit more explicit, like Ada with the reverse keyword, and the whole named loop/block which used with the exit keyword can make for more compact, succinct loops that still read without mental gymnastics.
These kinds of choice don't come alone, but together with the 'step' keyword, the opiniated absence of the 'continue' keyword and the availability or inner/embedded functions/procedures.
For me classic foreach iterators that mask the actual iterator fall apart when I need some kind of 'join' operation (do something specific on each first, last and neither elements of a collection).