MT4智能交易编程教程-赋值运算
包括给出运算式的表达式值就是赋值后留下的运算对象: - Assignment the x value to the y variable y = x;
复制代码
下面的运算式将赋值运算式与算法和逐位运算相结合: - Adding x to the y variable y += x;
- Subtracting x from the y variable y -= x;
- Multiplying the y variable by x y *= x;
- Dividing the y variable by x y /= x;
- Reminder of division of the y variable by x y %= x;
- The shift of the binary representation of y to the right by x bit y >>= x;
- The shift of the binary representation of y to the left by x bit y y <<= x;
- AND bitwise operation of binary representations of y and x y &= x;
- OR bitwise operation of binary representations of y and x y |= x;
- Excluding OR bitwise operation of binary representations of y and x y ^= x;
复制代码逐位算法只能用于整数。当y与右/左x完成逻辑移位时,x使用最小的二进制值5,放弃最大值,例如0-31间的移位。By %= 运算式 (x与y组件),结果等于分开数字符。赋值操作符在一个表达式中可以使用多次。这种情况下,表达式从左到右执行: 首先,x变量赋值3,y变量赋予x值,也是3。
|