Skip to main content

Practice ยท 3 of 4

Repeat a string

CHALLENGE
Difficulty: beginner+25 XP

Implement static string Repeat(string s, int times) โ€” s concatenated times times. Repeat("ab", 3) is "ababab"; times of 0 (or negative) yields "". Null input yields "" too.

Back to lesson: Practice: Method workshop