thomnor
February 3rd, 2008, 04:14 PM
Hi,
I wonder if it is possible to test if the next object in an array has changed its sign (from positive to negative, or vice versa) from the first element in the array.
Here's some pseudo code:
for i in range(n):
if some_array[i] has the opposite sign of some_array[0]:
some_array[i] = 0
I'm not a very experienced programmer, so there might be an easy solution I haven't thought of.
I wonder if it is possible to test if the next object in an array has changed its sign (from positive to negative, or vice versa) from the first element in the array.
Here's some pseudo code:
for i in range(n):
if some_array[i] has the opposite sign of some_array[0]:
some_array[i] = 0
I'm not a very experienced programmer, so there might be an easy solution I haven't thought of.