File: test_replicate.d

package info (click to toggle)
ironseed 0.4.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,816 kB
  • sloc: pascal: 27,286; ansic: 795; makefile: 282; perl: 277; sh: 229
file content (10 lines) | stat: -rw-r--r-- 236 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
import std.array;
import std.stdio;

void main() {
    auto arr = replicate(['s'], 5); // lazy version: https://dlang.org/phobos/std_range.html#repeat
    // or
    auto arr2 = ['s'].replicate(5);
    writeln(arr);
    writeln(arr2);
}