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

> : Greater Than Operator


On this page

Summary

Compare if the left value is greater than the right value.

Syntax

{{operand1 > operand2}}

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 greater than right operand, false otherwise.


Examples

Adult Verification

{{#if model.age > 18}}
  <div class="access-granted">
    <p>Age verified: {{model.age}} years old</p>
  </div>
{{else}}
  <div class="access-denied">
    <p>Must be 18 or older</p>
  </div>
{{/if}} 

Data:

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

Output:

<div class="access-granted">
  <p>Age verified: 25 years old</p>
</div>

High Value Order

{{#if model.orderTotal > 1000}}
  <div class="vip-order">
    <strong>High-Value Order</strong>
    <p>Expedited processing approved</p>
  </div>
{{/if}} 

Stock Availability

{{#if model.quantity > 0}}
  <p>{{model.quantity}} in stock</p>
{{else}}
  <p class="disabled" >Out of Stock</button>
{{/if}} 

Data:

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

Output:

<p>15 in stock</p>

Performance Indicator

{{#if model.revenue > model.target}}
  <div class="success">
    <h3>Target Exceeded!</h3>
    <p>Revenue: ${{format(model.revenue, 'N0')}}</p>
    <p>Target: ${{format(model.target, 'N0')}}</p>
    <p>Surplus: ${{format(model.revenue - model.target, 'N0')}}</p>
  </div>
{{/if}} 

Data:

doc.Params["model"] = new {
    revenue = 125000m,
    target = 100000m
};

Output:

<div class="success">
  <h3>Target Exceeded!</h3>
  <p>Revenue: $125,000</p>
  <p>Target: $100,000</p>
  <p>Surplus: $25,000</p>
</div>

Temperature Warning

{{#if model.temperature > 100}}
  <span class="danger">⚠ High Temperature Alert: {{model.temperature}}°F</span>
{{else if model.temperature > 80}}
  <span class="warning">Warm: {{model.temperature}}°F</span>
{{else}}
  <span class="normal">{{model.temperature}}°F</span>
{{/if}} 

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 “greater than or equal”, use >= operator

See Also