Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I was reviewing some Apex code when I found an expression like this:

if (a <> null && b != null) {
  ...
}

My gut feeling tells me that <> is an alternative way to say "not equals," is this correct? If so, is it different than !=, sort of like how != and !== are similar yet different?

I could not find any references to <> in the following documentation:

https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_expressions_operators_understanding.htm

http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_expressions_operators_precedence.htm

share|improve this question
    
Poll Response: I always use != –  amatorVitae Feb 27 at 22:05
add comment

1 Answer 1

up vote 5 down vote accepted

You're correct that it isn't in the docs. The operators are identical in operation.

<> is from the days of BASIC and != is from the days of C and is used by the languages that followed it. Most modern languages support both.

Wikipedia: Relational Operators

share|improve this answer
1  
Thanks. I know SQL uses <> too and it means the same thing. But I was not sure being a new language (to me). –  John Gaughan Feb 27 at 22:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.