Ruby:打印一些东西x次

Ars*_*nic 3 ruby string return append

我想要返回一个字符串'x'次.我目前的代码

return str + str + str + str
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能让它看起来像

return 4 * str
Run Code Online (Sandbox Code Playgroud)

Tho*_*tre 6

你很近......

return str * 4
Run Code Online (Sandbox Code Playgroud)