Euphoria-logical-operators

提供:Dev Guides
移動先:案内検索

幸福感-論理演算子

次の簡単なプログラム例は、論理演算子を示しています。 test.exファイルに次のEuphoriaプログラムをコピーして貼り付け、このプログラムを実行します-

#!/home/euphoria-4.0b2/bin/eui

integer a = 1
integer b = 0
integer c = 1

printf(1, "a and b = %d\n", (a and b) )
printf(1, "a or b = %d\n", (a or b) )
printf(1, "a xor b = %d\n", (a xor b) )
printf(1, "a xor c = %d\n", (a xor c) )
printf(1, "not(a) = %d\n", not(a) )
printf(1, "not(b) = %d\n", not(b) )

これにより、次の結果が生成されます。 ここで、0は偽を表し、1は真を表します。

a and b = 0
a or b = 1
a xor b = 1
a xor c = 0
not(a) = 0
not(b) = 1