Dear all,
sometimes you need to check divisons with rest value.
The operator of Modulo (a mod b) = c is not implemented in B4A. This function is easily giving this rest value but is done as a function:
Example:
Result: 1 (since 11 * 3 = 33 rest 1)
sometimes you need to check divisons with rest value.
The operator of Modulo (a mod b) = c is not implemented in B4A. This function is easily giving this rest value but is done as a function:
B4X:
' calculates (A mod B) and giving the rest
Sub Modulo(intA As Int, intB As Int) As Int
If intB = 0 then return
'
Return intA - Floor(intA / intB) * intB
'
End Sub
Example:
B4X:
Msgbox(Modulo(34, 3),"")
Last edited: