Fortran-logical-operators
提供:Dev Guides
Fortran-論理演算子
次の表は、Fortranでサポートされているすべての論理演算子を示しています。 変数 A が.trueを保持すると仮定します。 変数 B は.falseを保持します。 、その後-
Operator | Description | Example |
---|---|---|
.and. | Called Logical AND operator. If both the operands are non-zero, then condition becomes true. | (A .and. B) is false. |
.or. | Called Logical OR Operator. If any of the two operands is non-zero, then condition becomes true. | (A .or. B) is true. |
.not. | Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. | !(A .and. B) is true. |
.eqv. | Called Logical EQUIVALENT Operator. Used to check equivalence of two logical values. | (A .eqv. B) is false. |
.neqv. | Called Logical NON-EQUIVALENT Operator. Used to check non-equivalence of two logical values. | (A .neqv. B) is true. |
例
Fortranで利用可能なすべての論理演算子を理解するために、次の例を試してください-
上記のプログラムをコンパイルして実行すると、次の結果が生成されます-