下面的简单示例程序演示了关系运算符。复制并粘贴以下Euphoria 程序在test.ex文件并运行这个程序:
#!/home/euphoria-4.0b2/bin/eui integer a = 10 integer b = 20 printf(1, "a = b = %d\n", (a = b) ) printf(1, "a != b = %d\n", (a != b) ) printf(1, "a > b = %d\n", (a > b) ) printf(1, "a < b = %d\n", (a < b) ) printf(1, "b >= a = %d\n", (b >= a) ) printf(1, "b <= a = %d\n", (b <= a) ) |
这将产生下面的结果。这里0表示false,1表示true:
a = b = 0 a != b = 1 a > b = 0 a < b = 1 b >= a = 1 b <= a = 0 |
注: 其他的Euphoria 数据类型例如Euphoria 支持所有上述操作序列,原子和对象。