erlang Result = string:join(Fruit, ", "),
-module(joinwords).
-export([start/0]).
start() ->
Fruit = ["Apple", "Carrot", "Banana"],
Result = string:join(Fruit, ", "),
io:format("~s~n", [Result]).
% In Erlang atoms tend to be preferred over strings. Problem could have, instead, used list of atoms together
% with suitable conversion:
%
% Fruit = ['Apple', 'Carrot', 'Banana'],
% Result = string:join(lists:map(fun (X) -> atom_to_list(X) end, Fruit), ", "),