For Programmers: Free Programming Magazines  


Home > Archive > Clarion > July 2004 > ARRAY EXPERT NEEDED









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ARRAY EXPERT NEEDED
Ed2jak

2004-07-15, 3:55 pm

Hi All

Does anyone know how to lookat array elements in an array in one statement.
e.g. look at Myarray [1,1] to Myarray[2,20] and sum the contents of each
element.Each element in the array has two conditions 0 or 1 so in the above two
dimension array 20 x 20 elements if each element is 1 the result would be 40
and if 20 elements were 0 the result would be 20.

Help appreciated.

Eddie
Jason Berkan

2004-07-15, 8:55 pm

On 15 Jul 2004 16:58:00 GMT, ed2jak@aol.com (Ed2jak) wrote:
>Does anyone know how to lookat array elements in an array in one statement.
>e.g. look at Myarray [1,1] to Myarray[2,20] and sum the contents of each
>element.Each element in the array has two conditions 0 or 1 so in the above two
>dimension array 20 x 20 elements if each element is 1 the result would be 40
>and if 20 elements were 0 the result would be 20.


There is no way to do it in one statement, but a simple double loop
will work fine:

CLEAR(Total)
LOOP X = 1 TO 2
LOOP Y = 1 TO 20
Total += MyArray[X, Y]
END
END

Jason
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com