Difference between revisions of "Or"
From Free Pascal wiki
Jump to navigationJump to search (→Boolean operation: Clarify operands must be Boolean) |
|||
Line 3: | Line 3: | ||
= Boolean operation = | = Boolean operation = | ||
− | '''Or''' produces a value of [[True|true]] if some value is true and [[False|false]] if both of its operands are false. | + | Boolean '''Or''' produces a value of [[True|true]] if some value is true and [[False|false]] if both of its Boolean operands are false. |
== Truth table == | == Truth table == | ||
Line 23: | Line 23: | ||
|style="background: #eeeeee" | true | |style="background: #eeeeee" | true | ||
|} | |} | ||
− | |||
= Bitwise operation = | = Bitwise operation = |
Revision as of 04:52, 14 June 2016
│
Deutsch (de) │
English (en) │
suomi (fi) │
français (fr) │
русский (ru) │
Boolean operation
Boolean Or produces a value of true if some value is true and false if both of its Boolean operands are false.
Truth table
A | B | A or B |
---|---|---|
false | false | false |
false | true | true |
true | false | true |
true | true | true |
Bitwise operation
Bitwise or sets the bit to 1 if one corresponding bits in its operands are 1, and to 0 if they all are 0.
Set a bit
function SetBit(const AValue, ABitNumber:integer):integer;
begin
result := AValue or (1 shl ABitNumber);
end;
If you call SetBit(%1000,1) then get %1010 (%1000 = 8 and %1010 = 10). If you call SetBit(10,2) then get 14 (14 = %1110). If you call SetBit(10,1) then get 10.
See also