πŸ“˜ String repetition operator x in Perl 6

πŸ“˜ String repetition operator x in Raku

N. B. Perl 6 has been renamed to Raku. Click to read more.


x repeats the string the given number of times.

say "A" x 5; # AAAAA

Non-string values will be converted to strings before the operation.

say 0 x 5; # 00000

If the number of repetitions is negative or zero, an empty string is returned.

Leave a Reply

Your email address will not be published. Required fields are marked *

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code