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