I want to return string 'x' a number of times. My current code
return str + str + str + str
What should I do to do something like
return 4 * str
You are close ...
return str * 4
You can try this
4.times{puts string}
String * integer gives you a new string containing whole copies of the recipient, and the integer must be equal to or greater than 0. For example:> "Hello World!" * 3 ==> "Hello World! Hello World! Hello World!"
Link http://ruby-doc.org/core-2.3.1/String.html