Splitting up value inside array and get it individually

I have following array

{“abc”, “def”}

Now i want to get "abc" seperately and "def" seperately. How can i achieve this??

Here is one way to get at the tuple using elem:

t = {"abc", "def"}
k = elem(t, 0)
# "abc"
1 Like

You can also use pattern matching here:

{a, b} = {"abc", "def"}

or just one value:

{a, _} = {"abc", "def"}
{_, b} = {"abc", "def"}
4 Likes