Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

A way to get the sum of all elements in a single array?

What would be the best method to get the sum of integer or float values in a single array? I should also mention that the index numbers and element values in my array are not set in stone and can change.

I want to easily be able to add more elements or remove elements and adjust their values while still being able to find the sum of all the elements, preferably without copying and pasting a bunch of nodes for each element.

Any thoughts? Thanks!

Product Version: Not Selected
more ▼

asked Jan 20 '15 at 10:57 PM in Blueprint Scripting

avatar image

43 3 5 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Would this work for you?


more ▼

answered Jan 20 '15 at 11:31 PM

avatar image

6.8k 332 184 464

avatar image Tobbo Jan 20 '15 at 11:38 PM

Yeah that works! Thanks! :)

avatar image AlexanderLaheij May 18 '17 at 05:48 PM

Each time I change a value in the array (in details panel) it goes up. So the summary is not right, it's higher than it should. Meaning I have to press reset to change it back to the actual value. Anyway way to do this (pressing reset) automatic? I'm trying to find the answer now.

avatar image c4tnt May 18 '17 at 06:43 PM

You can try to reset Sum variable in the construction script function

avatar image AlexanderLaheij May 18 '17 at 06:59 PM

I have no idea where XD

avatar image AlexanderLaheij May 19 '17 at 07:00 AM

Figured it out ;)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question