#### Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Resolved by DJ Sures!

## How Can I Get The Sum Of An Array At Once?

Is it possible to get the sum of all the values in an array beside using a simple addition, index entry after index entry?

Thank you.

Synthiam ARC Pro is a cool new tool that will help unleash your creativity with programming robots in just seconds!

Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
PRO
Synthiam
#1
`Code:definearray(\$myArray, 5)\$myArray[0] = 10\$myArray[1] = 5\$myArray[2] = 2\$myArray[3] = 3\$myArray[4] = 5\$total = 0repeat(\$position, 0, getarraysize("\$myArray") - 1, 1)\$total = \$total + \$myArray[\$position]endrepeatprint("The total is " + \$total)`
#2
Thank you!
Now I'm looking forward to get the smallest value of an array... sort() doesn't seem to provide with this value while I thought it would by "magically" making the first index to bear the smallest value...
PRO
Synthiam
#3
It sure does - here...

`Code:definearray(\$test, 3)\$test[0] = 1\$test[1] = 3\$test[2] = 5sort(\$test, descending)print(\$test[0])`

Now the \$test[0] will be the value 5

#4
Yes it does work this way indeed... I don't know what happened, for a moment it didn't or it seemed that it didn't so I constructed another one of my spaghetti codes using simple sort(value1, value2) then sort() of sort(), of sort()... lol... to eventually realize that I had done it this way already... a couple weeks ago...
PRO
Synthiam
#5
Nice

Sometimes i forget to hit the REFRESH button when viewing the Variable Tab editing scripts. That's caught me a few times, maybe that's what happened
#6
Likely cause! Totally rings a bell!