Skip to content

if-greater

if-greater - check if left value is greater than right value

state-name:
tool: if-greater
arguments:
left: <number1>
right: <number2>
goto:
true: <greater-state>
false: <not-greater-state>

The if-greater tool performs a numeric comparison and returns "true" if the left value is greater than the right value, or "false" otherwise.

Both values are parsed as decimal numbers. The tool returns exit code 1 if either value cannot be parsed as a valid number.

ArgumentRequiredDefaultDescription
leftYes-The number to compare (left side)
rightYes-The number to compare against (right side)
CodeMeaning
0Success (outputs “true” or “false”)
1Missing argument or invalid number

The tool outputs "true" if left > right, or "false" otherwise.

The tool accepts:

  • Integers: 42, -10, 0
  • Decimals: 3.14, -0.5, 100.00
  • Scientific notation: 1.5e10, 2E-3
  • Whitespace-trimmed values

Invalid values that cause exit code 1:

  • Non-numeric strings: "abc", "ten"
  • Special values: NaN, Infinity
  • Empty strings or null
check-threshold:
tool: if-greater
arguments:
left: "{{ error_count }}"
right: "10"
goto:
true: too-many-errors
false: acceptable-errors
compare-performance:
tool: if-greater
arguments:
left: "{{ new_latency }}"
right: "{{ baseline_latency }}"
goto:
true: performance-degraded
false: performance-ok
check-cost:
tool: if-greater
arguments:
left: "{{ estimated_cost }}"
right: "{{ budget_limit }}"
goto:
true: over-budget
false: within-budget
check-retries:
tool: if-greater
arguments:
left: "{{ retry_count }}"
right: "3"
goto:
true: max-retries-exceeded
false: can-retry
get-coverage:
tool: bash
arguments:
command: ./coverage.sh | grep -o '[0-9.]*'
output: var(coverage)
next: check-coverage
check-coverage:
tool: if-greater
arguments:
left: "{{ coverage }}"
right: "80"
goto:
true: coverage-sufficient
false: coverage-too-low
check-age:
tool: bash
arguments:
command: 'echo $(( ($(date +%s) - $(stat -f %m file.txt)) / 86400 ))'
output: var(age_days)
next: is-stale
is-stale:
tool: if-greater
arguments:
left: "{{ age_days }}"
right: "7"
goto:
true: refresh-needed
false: still-fresh

Handle non-numeric values:

check-value:
tool: if-greater
arguments:
left: "{{ possibly_invalid }}"
right: "100"
goto:
true: above-threshold
false: below-threshold
on-error:
1: invalid-number-error