0
I would like to know how to add values to a "property", when an array displays different values for the second "property" and the same value for the first "property".
For example:
Entree:
array1: {
{nome: joao, sobrenome: silva},
{nome: claudio, sobrenome: silva},
{nome: jose, sobrenome: oliveira},
{nome: joao, sobrenome: costa}
}
Exit:
array2: {
{nome: joao, sobrenome: [silva, costa]},
{nome: claudio, sobrenome: silva},
{nome: jose, sobrenome: oliveira}
}
Could you help me understand how things are going, especially Return? Because I want to generate a different output that actually looks like this: array: { {name:Joao, silva:1, costa:1}, {name:Claudio, silva:1}... }, I need to know how many times Joao appeared as silva or another last name.
– Magno
@Magno is always better to ask the question exactly what you are looking for. So you don’t waste time or who answers :) I edited the answer, see if you understand better how it works and if you do what you want...
– Sergio
Perfect, Sergio I do not ask exactly what I want because I like trying to solve the problem, as I was struggling to know how to group the surnames asked only that. For example, instead of 1 it was to put the amount of times that the same last name appeared, but that I know how to do, so it looks like I did something tbm, haha. Thank you.
– Magno