12-11-2022, 08:43 PM
If one wants logical operations, then they need to end up writing their own.
I'm not certain what logical operators someone might want/need, but that's basically logical AND and OR. They're simple enough for folks to implement on their own, rather than using bitwise operators, if that's what they're wanting.
Code: (Select All)
Print 1 And 2
Print LogicalAND(1, 2)
Print 1 Or 2
Print LogicalOR(1, 2)
Function LogicalAND (num1, num2) 'if they're both true, then the result is true
If num1 <> 0 And num2 <> 0 Then LogicalAND = -1
End Function
Function LogicalOR (num1, num2) 'if either is true, then the result is true
'Note that this one isn't much different from a plain OR statement, except it keeps our result as a logical value of -1
If num1 <> 0 Or num2 <> 0 Then LogicalOR = -1
End Function
I'm not certain what logical operators someone might want/need, but that's basically logical AND and OR. They're simple enough for folks to implement on their own, rather than using bitwise operators, if that's what they're wanting.