Wanted: best way to express default expectations
Thu Oct 10 13:36:05 UTC 2019
On Thursday, 10 October 2019 at 11:50:59 UTC, Dukc wrote:
> On Thursday, 10 October 2019 at 11:47:21 UTC, Dukc wrote:
>> On Thursday, 10 October 2019 at 11:44:58 UTC, Nicholas Wilson
>> For loops, that's an excellent choice. But what about early
>> function returns?
> And also, sometimes it's not practical to filter the range up
> front. You may also want to shortcut out in middle of the
> `foreach` body, or `break` out of an outer loop, or `return`
> instead of just aborting the loop.
allows early stopping by having the iteration function return
No.each to stop the iteration, but I'm not sure whether this is
the thing you're looking for.
If you're trying to solve a more general problem that would
require the ability to return early from a nested scope I would
also suggest checking opApply (may work for a simpler scenario)
and Fibers, which when applied well can provide a substantial
increase in expressive power.
More information about the Digitalmars-d