Exercise: Join Two Strings

Practice how to join two strings in Elixir.

We'll cover the following

Challenge

Write a function prefix that takes a string, say str1. It should return a new function that takes another string, say str2. When that latter function is called, it will return a string of the format str1 str2.

Example

Iex> mrs = prefix.("Mrs")
#Function<erl_eval.6.82930912>
iex> mrs.("Smith")
"Mrs Smith"
iex> prefix.("Elixir").("Rocks") 
"Elixir Rocks"

Try to implement the challenge below. Remember to use the concepts taught in the previous lessons. Feel free to view the solution in the next lesson after giving it a few shots. Good luck!

Get hands-on with 1200+ tech skills courses.