What is difference between != and <> usage since both the operators are used for checking inequality in if condition? Is there any performance differences or execution time difference?
[SalesForce] Difference between != and <> comparison operators
Related Topic
- [SalesForce] what is the difference between String.Concat ,string.format and + in Salesforce
- [SalesForce] Difference between Database.executeBatch vs System.scheduleBatch
- [SalesForce] the difference between initializing a class property inline vs constructor
- [SalesForce] Difference between Transient and Static variable
Best Answer
They are syntactically equivalent.
However, I'd err towards always using
!=
.!=
is listed as the inequality operator in the Understanding Expression Operators documentation for Apex.!=
is listed as the Not Equals operator in the SOQL Comparison Operators.Both are listed in the Formula Operators.
Apex is a Java like language, which in turn is a C-like language. As such I'd follow the Java/C convention of using
!=
for not equal to.