What is if not equal
statement in beanshell ? if this is equal :
if ("myVarValue".equals(vars.get("MY_VARIABLE")))
What is if not equal
statement in beanshell ? if this is equal :
if ("myVarValue".equals(vars.get("MY_VARIABLE")))
Use the !
unary boolean
logical complement operator:
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
.
Another option for testing if (!something)
is to test if (something == false)
.