Suppose we have a method that returns a random string :
def return_random
"random generated string #{Time.now}"
end
How to create a new string that is an addition of n times of return_random.
Exemple :
new_string = return_random + return_random + ... + return_random [n times]
Edit: Using return_random * n won’t work because it’s copying the string n times and not generating new ones.
This will do it: