Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1149
  • Last Modified:

How do I SUM the values in a LotusScript integer array?

I have a non-dynamic LotusScript array of integer values and I want to SUM.  I understand that I need to loop through the array (ForAll?) and sum the values in each array element, but I'm not quite sure how to do it.  Need help FAST!  =)

Thanks, Chad
0
chad_wessel
Asked:
chad_wessel
  • 2
1 Solution
 
ghassan99Commented:
Dim values(5) As Integer
Dim x,y As Integer

values(0) = 25
values(1) = 20
values(2) = 15
values(3) = 10
values(4) = 5

y = 0

For x=0 to 4
   y = y + values(x)
End For

y has the total value of all the elements of the array.

-Gus
0
 
ghassan99Commented:
If you want to use ForAll:

ForAll x in values
   y = y + x
End ForAll

-Gus
0
 
chad_wesselAuthor Commented:
thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now