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

< : 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


  <div class="minor-warning">
    <p>Parental consent required (Age: )</p>
  </div>

  <p>Age verified:  years old</p>

Data:

doc.Params["model"] = new {
    age = 15
};

Output:

<div class="minor-warning">
  <p>Parental consent required (Age: 15)</p>
</div>

Low Stock Warning


  <div class="alert-warning">
    <strong>Low Stock Alert!</strong>
    <p>Only  units remaining</p>
  </div>

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


  <span class="freezing">⚠ Freezing conditions</span>

  <span class="cold">Cold</span>

  <span class="normal">Normal</span>

Discount Eligibility


  <div class="product">
    <h3></h3>
    <p>Price: $</p>

    
      <span class="badge">Budget Friendly</span>
    
  </div>

Progress Tracking


  <div class="progress-bar red" style="width: %">
    %
  </div>

  <div class="progress-bar yellow" style="width: %">
    %
  </div>

  <div class="progress-bar green" style="width: %">
    %
  </div>


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