Euphoria - 逻辑运算符



以下简单的示例程序演示了逻辑运算符。将 Euphoria 程序复制并粘贴到 test.ex 文件中,然后运行该程序 -

#!/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
euphoria_operators.htm
广告