Repeat and chunks

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 24 11:19:29 PDT 2016


On Monday, 24 October 2016 at 16:17:03 UTC, ag0aep6g wrote:
> On 10/24/2016 05:59 PM, Meta wrote:
>> repeat(8, 10).chunks(3).writeln();
>>
>> This will throw an AssertError because 10 is not evenly 
>> divisible by 3.
>
> chunks doesn't require that the length of the range be evenly 
> divisible by the chunk size.
>
> See https://dlang.org/phobos/std_range.html#.Chunks

Huh, you're right. I must've misread. My mistake.


More information about the Digitalmars-d-learn mailing list