english icon indicating copy to clipboard operation
english copied to clipboard

Proposal for a better opApply example

Open DimitarNestorov opened this issue 4 years ago • 0 comments

The current example uses recursion which can be hard to understand for newcomers. Maybe something like this would be better:

int opApply(int delegate(int) dg)
{
    foreach (i; 0 .. 5)
    {
        if (auto result = dg(i))
        {
            return result;
        }
    }
    return 0;
}

DimitarNestorov avatar Nov 18 '20 15:11 DimitarNestorov