Pascal-boolean-operators
提供:Dev Guides
パスカル-ブール演算子
次の表は、Pascal言語でサポートされているすべてのブール演算子を示しています。 これらの演算子はすべてブール値オペランドで機能し、ブール値の結果を生成します。 変数 A が真を保持し、変数 B が偽を保持すると仮定します-
Operator | Description | Example |
---|---|---|
and | Called Boolean AND operator. If both the operands are true, then condition becomes true. | (A and B) is false. |
and then | It is similar to the AND operator, however, it guarantees the order in which the compiler evaluates the logical expression. Left to right and the right operands are evaluated only when necessary. | (A and then B) is false. |
or | Called Boolean OR Operator. If any of the two operands is true, then condition becomes true. | (A or B) is true. |
or else | It is similar to Boolean OR, however, it guarantees the order in which the compiler evaluates the logical expression. Left to right and the right operands are evaluated only when necessary. | (A or else B) is true. |
not | Called Boolean NOT Operator. Used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make it false. | not (A and B) is true. |
次の例は、概念を示しています-
上記のコードをコンパイルして実行すると、次の結果が生成されます-