Sign in to follow this  
Followers 0
tbaror

_ArrayMin with condition

3 posts in this topic

Hello ,

i am using function _ArrayMin for lowest numerically value , but the array i am using this function might include value -1 that i would like to avoid ,my question is there any way to search for lower value but that bigger than -1 for this example?.

Thanks

Share this post


Link to post
Share on other sites



_ArrayMin is very easy to rewrite:

Dim $array[5]=[10,-1,8,2,6]

$lowest=_ArrayMin_Mod($array,0)
MsgBox(0,"Lowest is:",$lowest)

Func _ArrayMin_Mod(ByRef $aArray, $iFloor=0)
    Local $iLowest=""
    For $i=0 To Ubound($aArray)-1
        If $iLowest="" Or ( $aArray[$i]<$iLowest And $aArray[$i]>=$iFloor) Then
            $iLowest=$aArray[$i]
        EndIf
    Next
    Return $iLowest
EndFunc

muttley


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

thanks muttley

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0