!= : 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
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
Filter Out Null Values
Highlight Changes
Show Alert for Specific Conditions
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 != nullor 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