mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-16 16:44:05 +00:00
6e01fc8dce
Added new _STRCMP and _STRICMP commands for quick string comparisons. Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders. Altered UCASE and LCASE routines to be faster in some situations for us.
45 lines
No EOL
1.2 KiB
Text
45 lines
No EOL
1.2 KiB
Text
The '''OR''' numerical operator returns a comparative bit value of 1 if either value's bit is on.
|
|
|
|
|
|
{{PageSyntax}}
|
|
:: firstvalue '''OR''' secondvalue
|
|
|
|
|
|
* If both bits are off, it returns 0.
|
|
* If one or both bits are on then it returns 1.
|
|
* OR never turns off a bit and can be used only to turn a bit on.
|
|
|
|
|
|
{{Template:LogicalTruthTable}}
|
|
|
|
|
|
''Example 1:'' OR always turns bits on! Never off.
|
|
{{CodeStart}} '' ''
|
|
a% = 5 ' 101 binary
|
|
b% = 4 ' 100 binary
|
|
results% = a% {{Cl|OR}} b% ' still 101 binary using OR
|
|
{{Cl|PRINT}} "Results% ="; results% '' ''
|
|
{{CodeEnd}}
|
|
{{OutputStart}}
|
|
Results% = 5
|
|
{{OutputEnd}}
|
|
|
|
|
|
''Example 2:'' Turning a data register bit on.
|
|
{{CodeStart}} '' ''
|
|
address% = 888 'parallel port data register
|
|
bytevalue% = {{Cl|INP}}(address%)
|
|
{{Cl|OUT}} address%, bytevalue% {{Cl|OR}} 4 '' ''
|
|
{{CodeEnd}}
|
|
|
|
:''Explanation:'' The third register bit is only turned on if it was off. This ensures that a bit is set. OR could set more bits on with a sum of bit values such as: OUT address%, 7 would turn the first, second and third bits on. 1 + 2 + 4 = 7
|
|
|
|
|
|
|
|
''See also:''
|
|
* [[AND]], [[XOR]]
|
|
* [[AND (boolean)]], [[OR (boolean)]]
|
|
* [[Binary]], [[Boolean]]
|
|
|
|
|
|
{{PageNavigation}} |