< : Less Than Operator
On this page
Summary
Compare if the left value is less than the right value.
Syntax
Precedence
Priority level in expression evaluation (1 = highest, 10 = lowest): 6
Evaluated after: ^, *, /, %, +, -
Evaluated before: ==, !=, ??, &&, ||
Operands
| Position | Type | Description |
|---|---|---|
| Left | Comparable | First value to compare |
| Right | Comparable | Second value to compare |
Returns
Type: Boolean
true if left operand is less than right operand, false otherwise.
Examples
Age Restriction
Data:
doc.Params["model"] = new {
age = 15
};
Output:
<div class="minor-warning">
<p>Parental consent required (Age: 15)</p>
</div>
Low Stock Warning
Data:
doc.Params["model"] = new {
quantity = 5,
threshold = 10
};
Output:
<div class="alert-warning">
<strong>Low Stock Alert!</strong>
<p>Only 5 units remaining</p>
</div>
Temperature Check
Discount Eligibility
Progress Tracking
Notes
- Works with numbers, dates, and comparable types
- String comparison is case-sensitive and uses lexicographic ordering
- Date comparison compares chronological order
- Cannot compare incompatible types
- Commonly used with `` for conditional rendering
- Can be combined with logical operators (
&&,||) - For “less than or equal”, use
<=operator
See Also
- Less Than or Equal Operator
- Greater Than Operator
- Greater Than or Equal Operator
- #if Helper
- Equality Operator