C#, double type variable, has 1 branch (1 value) but 5 data(?) How to get them all

I have one variable of type double that has in it stored 5 ‘values’.
How do I get them out so I can add them?

(this is a gif; if it doesn’t auto-play, click on it)

then you can loop through them

double sum = 0;
foreach (double n in x)
    sum += n;

Thank you!
But I get an error

To make it clearer, I have:

double x;

That does not make it a lot clearer. I think you’d better post your file.

1 Like

Show.gh (5.7 KB)

Now I’m even more confused as to what you are trying to do…your component works just fine.
Did you just wanna add the results of the p2p distances? If so, try this.
Show_ww.gh (10.9 KB)


Thank you very much! You are right, it works perfectly :slight_smile:

I guess I was just confused with the n.
foreach (double n in x)
sum += n;

(I just started with c#).
I don’t get where the name of the variable comes from and what it represents.
I was doing (in the case of my code):

I also didn’t see the gif, also very helpful!