0
Answered

How to SUM element Recursively inside a list

agan 2 years ago updated by anonymous 2 years ago 4

Let's say i have a list of integer element, that consist of 10 items...

How to sum it recursively using Bolt ?

currently, i try to use Foreach-Loop, but dont know where to go from this...



===Update

it seems to complicated just to sum it all, i'll rather write custom c# code for this function then add to graph...

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED
Satisfaction mark by agan 2 years ago
+3

The easiest way I thought of is simply make a variable, add each loop item to it :)

In this example I created the variable at runtime after start, but you can use the "Variables Window" to define it earlier and make the system cleaner if you don't need it to be modular.


it seems to complicated just to sum it all, i'll rather write custom c# code for this function then add to graph...

That's number 1 thing I love about Bolt!  Worst case, whip up your own unit!

Hi, thanks i'll try...