Is there a function in B4A that you can pass in a number and the function returns true if the number is within a range?
Example:
B4X:
Sub fcnNumberInRange (intNumberIn as Int, intRangeStarting as Int, intRangeEnding as Int) As Boolean
' Code to determine if the passed in number is within the range.
If the number is in the range then
return true
else
return false
end if
End Sub
Usage like testing if 55 is in between 20 and 100:
B4X:
If fcnNumberInRange (55, 20, 100) then
' Do something here.
End If
I dont know such sub. But why dont you write your own?
It should be easy to do.
B4X:
sub fcnNumberInRange (value as double, minval as double, maxval as double )
if value >= minval then
if value <= maxval then
return true
else
return false
end if
else
return false
end if
end sub
I dont know such sub. But why dont you write your own?
It should be easy to do.
B4X:
sub fcnNumberInRange (value as double, minval as double, maxval as double )
if value >= minval then
if value <= maxval then
return true
else
return false
end if
else
return false
end if
end sub