I have an array that many elements, but two of them are important to me. Language and number
I get the info from them someting like that
_ = cities[0].language
\\give me a string languages(it could be any languages and maybe it's nil, but all the language are written in same way (for example it's always English, not english)
and
_ = cities[0].number
\\give me an Int
for example it gives me something like that
"English" "124324"
"French" "5634"
"English" "753"
"German" "8643"
"German" "532"
nil "6532"
I want to create a new array(let's call languageInfo
), that created by filtering the cities
array.
I need it combine all the same lanugage together with sum of their numbers, for example the output should be something like that
for example it gives me something like that
"English" "125077"
"German" "9175"
"French" "5634"
"nil" "6532"
Could anyone tell me how to do that?