And
Deutsch · English · Español · Français · Suomi · Русский
The binary operator and performs a logical conjunction. FPC also does a bitwise and when supplied with ordinal types.
Boolean operation
The operator and accepts to two Boolean type values. It is the logical conjunction written in classic logic as $A \land B$. Electrical engineers may write $A \times B$ or $A \cdot B$, or eliminating the multiplication sign altogether writing $AB$. However, the [[*|asterisk]] has a different meaning in programming. The Boolean and evaluates to true if and only if both operands are true.
A |
B |
A and B |
|---|---|---|
false |
false |
false |
false |
true |
false |
true |
false |
false |
true |
true |
true |
Bitwise operation
FPC also defines a bitwise and. Taking two ordinal operands logical and is calculated bit by bit:
1010'1100
and 0011'0100
????????????????????????????????????
0010'0100comparative remarks
Depending on the compiler's specific implementation of the data type set, the intersection of sets virtually does the same as the bitwise and.
see also
From the Free Pascal wiki, page "And", as it stood on 2022-11-27 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
