IDL中的运算符(简明)

1 篇文章 0 订阅

Logical Operators
逻辑运算符

&&和(AND)A && B
||或(OR)A || B
~否(Negation)~[1,2,0]

Mathematical Operators
算数运算符

+加(Addition)B=3+6
+字符连接(String Concatenation)B=‘john’+‘Doe’
+列表或哈希连接(String Concatenation)list3=list1+list2
++自增(Increment)A++
-减(Subtraction)C=9-5
-取反(Negation)C =-C
自减(Decrement)A–
*乘(Multiplication)C=2*5
*指针取消引用(Pointer dereference)
/除(Division)D=10.0/3.2
^乘方(Exponentiation)B=2^3
MOD模(Modulo)A= 9 MOD 5

Bitwise Operators
位运算符

AND按位与(Bitwise AND)5 AND 6 = 4
NOT按位取反(Bitwise NOT)NOT 4 = -5
OR按位或(Bitwise OR)3 OR 5 = 7
XOR按位异或(Bitwise exclusive OR)3 XOR 5 = 6

Relational Operators
关系运算符

EQ等于(Equal to)2 EQ 2.0
NE不等于(Not Equal to)‘sun’ EQ ‘fun’
GE大于等于(Greater than or equal to)A GE 100
GT大于(Greater than)A GT 5
LE小于等于(Less than or equal to)A LE B
LT小于(Less than)A LT B

Opertor Precedence
运算符优先级

First (highest)( ) (parentheses, to group expressions)
First (highest)[ ] (brackets, to concatenate arrays)
Second. (structure field dereference)
Second[ ] (brackets, to subscript an array)
Second( ) (parentheses, used in a function call)
Third* (pointer dereference)
Third^ (exponentiation)
Third++ (increment)
Third– (decrement)
Fourth* (multiplication)
Fourth# and ## (matrix multiplication)
Fourth/(division)
FourthMOD (modulus)
Fifth+ (addition)
Fifth- (subtraction and negation)
Fifth< (minimum)
Fifth> (maximum)
FifthNOT (bitwise negation)
Fifth~ (logical negation)
SixthEQ (equality)
SixthNE (not equal)
SixthLE (less than or equal)
SixthLT (less than)
SixthGE (greater than or equal)
SixthGT (greater than)
SeventhAND (bitwise AND)
SeventhOR (bitwise OR)
SeventhXOR (bitwise exclusive OR)
Eighth&& (logical AND)
Eighth|| (logical OR)
Ninth?: (conditional expression)

Matrix Operators
矩阵运算符

#通过将第一个数组的列乘以第二个数组的行来计算数组元素。第二个数组的列数必须与第一个数组的行数相同。所得数组的列数与第一个数组相同,行数与第二个数组相同。A#B
##通过将第一个数组的行乘以第二个数组的列来计算数组元素。第二个数组的行数必须与第一个数组的列数相同。所得数组的行数与第一个数组相同,列数与第二个数组相同。B##A

Minimum and Maximum Operators
最大最小运算符

<最小运算符X=X0<X1<X2X为三者中最小值
>最大运算符X=X0>X1>X2X为三者中最大值

Other Operators
其他运算符

[]数组连接(Array concatenation)C = [0, 1, 3]
[ : : ]冒号运算符(Colon operator)[0:10]
()顺序控制与参数封装( 3 +( 4 * 2)^ 2 / 2)
?:条件表达式(Conditional expression)Z = (A GT B) ? A : B
.方法调用(Method invocation)oWindow.Draw
->方法调用(Method invocation)oWindow->Draw

Assignment and Compound Assignment
分配和复合分配

=分配(Assignment)A = 0
op=复合分配(Compound Assignment) (op为运算符)A + = 5
  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值