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

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy