Repeat and chunks

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 24 09:17:03 PDT 2016


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


More information about the Digitalmars-d-learn mailing list