B4R Tutorial XOR operation for Boolean

Tayfur

Well-Known Member
Licensed User
Do you have more good solitions; Please share it on my article.
thanks sharings.

B4X:
'    ----XOR-------
'    A B Output
'    -----------
'    0 0    0
'    0 1    1
'    1 0    1
'    1 1    0
Public Sub XOR(a As Boolean, b As Boolean) As Boolean
    Dim aa,bb As UInt
    If a Then aa=1 Else aa=0
    If b Then bb=1 Else bb=0
       
    Select Bit.Xor(aa,bb)
        Case 1
            Return True
        Case 0
            Return False
    End Select
    Log("ERROR for XOR function")
    Return False
End Sub
 
Top