How to upcase [“one”,“two”] to [“ONE”,“TWO”]?

Hello,am new to Elixir and am trying to write a function like that takes input of [“one”,“two”] and returns [“ONE”,“TWO”]
Am made to understand that this in Elixir there are two types of string the ones with a single quote and other with binary quote.So am trying to figure out how to do this whether to map the enumerables on a string and use string.upcase() to convert it.
here is my code:
def to_upper(strings) do
animals = IO.gets[“animal1”, “animal2”, “animal3”]
IO.puts String.upcase(animals)
end

1 Like

We can give you the answer to your question but I am afraid it is not what you need. If you are new to functional programming, you really should read a book. btw: the answer to your question is:

Enum.map(strings, &String.upcase/1)
4 Likes

A post was split to a new topic: Question