Skip to content

Latest commit

 

History

History
12 lines (10 loc) · 238 Bytes

8 kyu - String repeat.md

File metadata and controls

12 lines (10 loc) · 238 Bytes

Task

Write a function called repeatStr which repeats the given string string exactly n times.

repeatStr(6, "I") // "IIIIII" repeatStr(5, "Hello") // "HelloHelloHelloHelloHello"

Solution

def repeat_str (n, s)
  s * n
end