Exercise 4: Prepend a String

Prepend a string to another string.

Problem statement

Skim through the Ruby documentation for strings, and look for a method that prepends one string to another string. Using that method, prepend the first string with the other.

Note: Do not use concatenation to solve this challenge.

Example

string1 = "Machine ", string2 = "Learning"
result = "Machine Learning"

Try it yourself

Press + to interact
def prepend_string(string1, string2)
result = ""
# Start your code here
return result
end