What is the cleanest way to exclude an element in an array when summing?
Example:
array.sum(exclude index 5);
Rather than trying to build a temporary array or skip over that value, it might be faster to just subtract the value of array[5] from the sum:
array.Sum() - array[5]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With