beanshell 中的 if not equal
语句是什么?如果这相等:
if ("myVarValue".equals(vars.get("MY_VARIABLE")))
最佳答案
使用!
一元boolean
逻辑补运算符:
if (!"myVarValue".equals(vars.get("MY_VARIABLE")))
引用文献
The type of the operand expression of the unary
!
operator must beboolean
orBoolean
, or a compile-time error occurs. The type of the unary logical complement expression isboolean
.At run time, the operand is subject to unboxing conversion if necessary; the value of the unary logical complement expression is
true
if the (possibly converted) operand value isfalse
andfalse
if the (possibly converted) operand value istrue
.
测试 if (!something)
的另一个选项是测试 if (something == false)
。
相关问题
关于java - Beanshell 不等于语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3179359/