tags:

views:

20

answers:

1

What is if not equal statement in beanshell ? if this is equal :

if ("myVarValue".equals(vars.get("MY_VARIABLE")))
+1  A: 

Use the ! unary boolean logical complement operator:

if (!"myVarValue".equals(vars.get("MY_VARIABLE")))

References

The type of the operand expression of the unary ! operator must be boolean or Boolean, or a compile-time error occurs. The type of the unary logical complement expression is boolean.

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 is false and false if the (possibly converted) operand value is true.


Another option for testing if (!something) is to test if (something == false).

Related questions

polygenelubricants