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 代表 false,1 代表 true。
a and b = 0 a or b = 1 a xor b = 1 a xor c = 0 not(a) = 0 not(b) = 1