here is my code

Code:
mainloop:

for index = 1 to 3 step 1                                   ; read 10 values for 3 sensors
 
    For index2 = 1 to 10  step 1                            ; Take 10 reading
          
        if temp_val[index2] < temp_val_lo[index] then       ; is readling lower than lowest
            temp_val_lo[index] = temp_val[index2]           ; update lowest
            temp1[index] = temp1[index] + temp_val[index2]  ; add reading to running total                             
        else if temp_val[index2] > temp_val_hi[index] then  ; is reading higher than highest
            temp_val_hi[index] = temp_val[index2]           ; update highest
            temp1[index] = temp1[index] + temp_val[index2]  ; add reading to running total
        else                                                ; if reading not highest or lowest 
            temp1[index] = temp1[index] + temp_val[index2]  ; add reading to running total   
    
    next index2                                             ; update next reading
            
next index                                                  ; update next sensor

goto mainloop