x>y &&z==5 - 这个表达式的部分是如何调用的? [英] x>y && z==5 - how are parts of this expression called?
问题描述
我知道 &&这里是逻辑运算符,左边和右边的条件也是操作数,对吗?喜欢:
I know && is the logical operator here, also conditions on the left and on the right are operands, right? Like:
1+1 是一个表达式,其中 + 是运算符,数字是操作数.我只是不知道条件本身是否也称为操作数,因为它由运算符进行比较.我想是的.+
1+1 is an expression where + is the operator and the numbers are operands. I just do not know whether the condition itself is called the operand as well because it get compared by an operator. I guess so.+
谢谢
推荐答案
零件叫什么?
>
、&&
和 ==
都是运算符.操作数是传递给运算符的值.x
、y
和 z
是初始操作数.一旦 x >y
和 z == 5
被评估,这些布尔结果用作 &&
运算符的操作数,这意味着 表达式本身不是 &&
的操作数,这些表达式的计算结果是操作数.
>
, &&
, and ==
are all operators. Operands are the values passed to the operators. x
, y
, and z
are the initial operands. Once x > y
and z == 5
are evaluated, those boolean results are used as the operands to the &&
operator which means the expressions themselves are not the operands to &&
, the results of evaluation those expressions are the operands.
当您将操作数和运算符放在一起时,您会得到一个表达式(即 x > y
, z == 5
, boolResult == boolResult
)
When you put operands and an operator together, you get an expression (i.e. x > y
, z == 5
, boolResult == boolResult
)
他们是如何评估的?
在大多数(如果不是全部)语言中 x >y
将首先被评估.
In most (if not all) languages x > y
will be evaluated first.
在支持短路的语言中,如果 x >y
是假的.否则,z == 5
是下一个.
In languages that support short circuiting, evaluation will stop if x > y
is false. Otherwise, z == 5
is next.
同样,在支持短路的语言中,如果 z == 5
为假,评估将停止.否则,&&
将排在最后.
Again, in languages that support short circuiting, evaluation will stop if z == 5
is false. Otherwise, the &&
will come last.
>
、&&
和 ==
都是运算符.操作数是传递给运算符的值.x
、y
和 z
是初始操作数.一旦 x >y
和 z == 5
被评估,这些布尔结果用作 &&
运算符的操作数.
>
, &&
, and ==
are all operators. Operands are the values passed to the operators. x
, y
, and z
are the initial operands. Once x > y
and z == 5
are evaluated, those boolean results are used as the operands to the &&
operator.
这篇关于x>y &&z==5 - 这个表达式的部分是如何调用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!