# Why was StringRepeat designed so that StringRepeat[s, 0] throws an error?

I'm wondering about the rationale behind the design decision that leads to the following expression throwing an error:

StringRepeat[" ", 0]

(* StringRepeat::intp: Positive integer expected at position 2 in StringRepeat[ ,0]. >> *)


I would expect it to just return an empty string.

I'd like to understand what reasons could be behind this decision.

• I think "bug" is probably too strong a word, but it seems like an infelicitous choice, given how similar functions (Table, ConstantArray et c.) work. – Pillsy Oct 21 '15 at 20:07
• IMO quite possibly an oversight, why don't you contact support and ask? This is one of the recently added convenience functions (some of which are not yet up to the usual quality standards). – Szabolcs Oct 21 '15 at 20:44
• I'll go ahead and report this as a suggestion for you. – Searke Oct 21 '15 at 21:41
• I can't think of too many examples in my head, but I'm sure if I think I can come up with some plausible logic for why this should be :). – Searke Oct 21 '15 at 21:42
• This would affect other functions like StringPadRight, StringPadLeft and would be impossible with StringPartition – Searke Oct 21 '15 at 21:48