J
Josselin
Is there a simple function (I solve it w a loop.. C-minded) to find the
index of the first bigger element in an array
limit mini is first_element , if item < last_element
item = -2.23
anArray = [0.0, 2.0, 5.0, 10.0, 15.0, 25.0] first_bigger_element =
0.0 index 0
item = 2.85
anArray = [0.0, 2.0, 5.0, 10.0, 15.0, 25.0] first_bigger_element =
5.0 index 2
item = 12.55
anArray = [0.0, 2.0, 5.0, 10.0, 15.0, 25.0] first_bigger_element =
15.0 index 4
limit maxi is last_element , if item > last_element
item = 36.59
anArray = [0.0, 2.0, 5.0, 10.0, 15.0, 25.0] first_bigger_element =
25.0 index 5
can it be writtent in just one line or a loop is unavoidable ?
thanks
joss
index of the first bigger element in an array
limit mini is first_element , if item < last_element
item = -2.23
anArray = [0.0, 2.0, 5.0, 10.0, 15.0, 25.0] first_bigger_element =
0.0 index 0
item = 2.85
anArray = [0.0, 2.0, 5.0, 10.0, 15.0, 25.0] first_bigger_element =
5.0 index 2
item = 12.55
anArray = [0.0, 2.0, 5.0, 10.0, 15.0, 25.0] first_bigger_element =
15.0 index 4
limit maxi is last_element , if item > last_element
item = 36.59
anArray = [0.0, 2.0, 5.0, 10.0, 15.0, 25.0] first_bigger_element =
25.0 index 5
can it be writtent in just one line or a loop is unavoidable ?
thanks
joss