Skip to main content Link Search Menu Expand Document (external link)

!= : Inequality Operator


On this page

Summary

Compare two values for inequality. Returns true if values are not equal.

Syntax



Precedence

Priority level in expression evaluation (1 = highest, 10 = lowest): 7

Evaluated after: ^, *, /, %, +, -, <, <=, >, >=

Evaluated before: ??, &&, ||


Operands

Position Type Description
Left Any First value to compare
Right Any Second value to compare

Returns

Type: Boolean

true if the operands are not equal, false if they are equal.


Examples

Exclude Specific Status


  <div class="order-active">
    <h3>Order #</h3>
    <p>Status: </p>
  </div>

Data:

doc.Params["model"] = new {
    status = "pending",
    orderNumber = "12345"
};

Output:

<div class="order-active">
  <h3>Order #12345</h3>
  <p>Status: pending</p>
</div>

Check for Non-Zero


  <p class="outstanding">Balance due: $</p>

Filter Out Null Values


  
    <p>: </p>
  

Highlight Changes


  
    <div class="price-changed">
      <span></span>
      <span class="old">$</span>
      <span class="new">$</span>
    </div>
  

Show Alert for Specific Conditions


  <div class="alert-warning">
    <p>Stock discrepancy detected!</p>
    <p>Expected: , Actual: </p>
  </div>

Data:

doc.Params["model"] = new {
    stock = 47,
    expectedStock = 50
};

Output:

<div class="alert-warning">
  <p>Stock discrepancy detected!</p>
  <p>Expected: 50, Actual: 47</p>
</div>

Notes

  • Works with all data types (strings, numbers, booleans, objects)
  • String comparison is case-sensitive
  • For null checks, use value != null or null coalescing ??
  • Opposite of == (equality) operator
  • Commonly used with `` for conditional rendering
  • Can be combined with logical operators (&&, ||)
  • Type conversion may occur between compatible types

See Also