1
0
forked from Mirror/wren
Files
wren/test/core/string/multiply.wren
Bob Nystrom d46dfc9500 Allow "*" on lists and strings to repeat them.
This is not implemented on Sequence because, at least for lists and
strings, I think users expect an eager result. Multiplying a string
should give you back a string, not a lazy sequence of repeated
characters.

This also mirrors "+" on strings and lists, which is eager. I like the
idea of having a general guideline that operators are eager.

Repetition is useful for arbitrary sequences, but for that maybe we
should add a "repeat()" method.
2016-02-24 07:48:03 -08:00

4 lines
137 B
Plaintext

System.print("|" + "abc" * 0 + "|") // expect: ||
System.print("abc" * 1) // expect: abc
System.print("abc" * 4) // expect: abcabcabcabc