Difference between != and <> comparison operators

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?

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.

Attribution
Source : Link , Question Author : Pankaj Ganwani , Answer Author : Daniel Ballinger

Leave a Comment