How to get List consisted by repeated items in Perl6?

101 Views Asked by At

I try to use: (^10).map({0}) to generate a list with 10 '0'. Is there another way to do it?

1

There are 1 best solutions below

1
raiph On BEST ANSWER
0 xx 10

Generates a list of 10 integers numbered zero.

'0' xx 10

Generates a list of 10 strings consisting of the single character '0'.

See xx infix op doc.

'0' x 10

Generates a single string consisting of a sequence of 10 '0' characters.

See x infix op doc.