Hi there, I am new to this community and am excited to start my journey in Elixir. I was having trouble understanding why I couldn’t pipeline to the concatenation operator. What I wanted to do was:
data |> String.replace("\n", "") <> " some more text\n"
but this does not work. However, I know that I can do this instead:
new_data = data |> String.replace("\n", "")
new_data <> " some more text\n"
I just would like to know why this is the case?
Thanks in advance.
Hi,
actually, you can but you need to explicit it by Kernel.<>(...)
like any operator.
data
|> String.replace("\n", "")
|> Kernel.<>(" some more text\n")
5 Likes
Thank you!