DAY 019: EQV
#6
If one wants logical operations, then they need to end up writing their own.

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.  Wink
Reply


Messages In This Thread
DAY 019: EQV - by SMcNeill - 11-25-2022, 05:59 PM
RE: DAY 019: EQV - by Pete - 11-25-2022, 06:51 PM
RE: DAY 019: EQV - by mnrvovrfc - 11-25-2022, 07:11 PM
RE: DAY 019: EQV - by Dimster - 11-25-2022, 08:19 PM
RE: DAY 019: EQV - by TempodiBasic - 12-11-2022, 04:46 PM
RE: DAY 019: EQV - by SMcNeill - 12-11-2022, 08:43 PM



Users browsing this thread: 1 Guest(s)