What is a quick way to print a triangle? I'm thinking without foreach, not like I have here.

foreach(line; iota(1, 10 + 1)) {
        writeln("#".replicate(line));
}

These don't work:

iota(1, 10 + 1).
tee!((a) => { writeln("#".replicate(a)); });

string result;
iota(1, 10 + 1).
tee!((a) => result ~= "#".replicate(a) ~ "\n");
writeln(result);

Reply via email to