It performs a logical bitwise OR of two bit patterns
Or ivar, j( command)
int = i Or j( operator)
int = Or(i, j [,m,…])( function)
large =x Or8 y( operator)
large = Or8(x, y [,z,…])( function)
ivar:integer variable
i, j:integer expression
x,y,z...:64-bit integer expression
Or can be used as a command, an operator, and as a function, Or8 only as an operator and function.
Or sets only the bits which are set in at least one of the two operands i or j.
Bit 1 | Bit 2 | Result |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Local a As Int32 = 3, b As Large = 2 ^ 45
Print a Or 6
Print b Or8 2 ^ 19
Print Or(a, 6)
Print Or8(b, 2 ^ 19)
Or a, 6 : Print a
Or b, 2 ^ 19 : Print b
The operator Or is synonymous with %| (or |) and can be used instead:
Print Bin$(3 Or 10, 4) // Prints 1011
Print Bin$(3 %| 10, 4) // Prints 1011
Print Bin$(3 | 10, 4) // Prints 1011
<Xor, Imp, Eqv, %&, |, ~, Operator Hierarchy
{Created by Sjouke Hamstra; Last updated: 20/10/2014 by James Gaite}