js1234 Member Licensed User Longtime User Jan 27, 2019 #1 What is XOR boolean operator? Like "And" "Or" …. why using "Xor" get syntax error? BR
Johan Schoeman Expert Licensed User Longtime User Jan 27, 2019 #2 Xor output is true if only one of the inputs are true 1 xor 0 = 1 0 xor 1 = 1 0 xor 0 = 0 1 xor 1 = 0 Upvote 0
Xor output is true if only one of the inputs are true 1 xor 0 = 1 0 xor 1 = 1 0 xor 0 = 0 1 xor 1 = 0
js1234 Member Licensed User Longtime User Jan 27, 2019 #3 Johan Schoeman said: Xor output is true if only one of the inputs are true 1 xor 0 = 1 0 xor 1 = 1 0 xor 0 = 0 1 xor 1 = 0 Click to expand... Yes Yes I know ….. but: B4X: Dim bTest1 As Boolean Dim bTest2 As Boolean If bTest1 And bTest2 Then End If working OK but this is SYNTAX ERROR: B4X: If bTest1 Xor bTest2 Then End If Why? Upvote 0
Johan Schoeman said: Xor output is true if only one of the inputs are true 1 xor 0 = 1 0 xor 1 = 1 0 xor 0 = 0 1 xor 1 = 0 Click to expand... Yes Yes I know ….. but: B4X: Dim bTest1 As Boolean Dim bTest2 As Boolean If bTest1 And bTest2 Then End If working OK but this is SYNTAX ERROR: B4X: If bTest1 Xor bTest2 Then End If Why?
Johan Schoeman Expert Licensed User Longtime User Jan 27, 2019 #4 js1234 said: Yes Yes I know ….. but: B4X: Dim bTest1 As Boolean Dim bTest2 As Boolean If bTest1 And bTest2 Then End If working OK but this is SYNTAX ERROR: B4X: If bTest1 Xor bTest2 Then End If Why? Click to expand... B4X: Dim b1 As Int = 1 Dim b2 As Int = 1 Dim b3 As Int b3 = Bit.Xor(b1,b2) Log(b3) Upvote 0
js1234 said: Yes Yes I know ….. but: B4X: Dim bTest1 As Boolean Dim bTest2 As Boolean If bTest1 And bTest2 Then End If working OK but this is SYNTAX ERROR: B4X: If bTest1 Xor bTest2 Then End If Why? Click to expand... B4X: Dim b1 As Int = 1 Dim b2 As Int = 1 Dim b3 As Int b3 = Bit.Xor(b1,b2) Log(b3)
js1234 Member Licensed User Longtime User Jan 27, 2019 #5 So parameter are Int and not Boolean ... and xor is bitwise operation... Upvote 0
Johan Schoeman Expert Licensed User Longtime User Jan 27, 2019 #6 js1234 said: So parameter are Int and not Boolean ... and xor is bitwise operation... Click to expand... Just write a small sub to handle XOR of Booleans Last edited: Jan 27, 2019 Upvote 0
js1234 said: So parameter are Int and not Boolean ... and xor is bitwise operation... Click to expand... Just write a small sub to handle XOR of Booleans
Erel B4X founder Staff member Licensed User Longtime User Jan 27, 2019 #7 B4X: 'XOR: If b1test <> b2test Then Upvote 0