Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

論理演算子

二項論理演算子は 2 つあり、複数の条件から構成される複合条件を評価します。また単項論理演算子は、条件の値を反転します。複合条件を指定する場合、括弧を使用して式をわかりやすく表現します。

論理演算子
演算子 演算 例 (条件が True の場合)
&& And。条件が True になるには、すべての条件が True である必要があります。 if (2 = 2) && (3 = 3) {write "both are true"}
|| Or。条件が True になるには、少なくとも 1 つの条件 (あるいは両方) が、True の必要があります。 if (2 = 2) || (3 = 4) {write "one is true"}
' Negation (Not)。否定条件が True になるには、元の条件が False の必要があります。 if '(2 = 3) {write "unequal"}
FeedbackOpens in a new tab