repeat

Jesse Phillips jessekphillips+D at gmail.com
Mon Jan 17 13:13:29 PST 2011


bearophile Wrote:

> n = 6
> s = "+---" * n + "+"
> print s
> for i in xrange(5):
>     print "|   " * n + "|"
>     print s

Are you saying that (sorry not testing, but since this is fictional at this time anyway):

auto n = 6;
auto s = join(repeat("+---", n), "+");
print s;
foreach(i; 0..5) {
    writeln(join(repeat("|   ", n), "|"));
    writeln(s);
}

isn't good enough? Maybe there is a performance benefit to not needing join?



More information about the Digitalmars-d mailing list