Skip to content

if-less

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

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

The if-less tool performs a numeric comparison and returns "true" if the left value is less 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.

check-iteration:
tool: if-less
arguments:
left: "{{ current_iteration }}"
right: "{{ max_iterations }}"
goto:
true: continue-loop
false: exit-loop
check-capacity:
tool: if-less
arguments:
left: "{{ current_count }}"
right: "{{ max_capacity }}"
goto:
true: has-capacity
false: at-capacity
check-temp:
tool: bash
arguments:
command: sensors | grep 'Core 0' | grep -oP '\+\K[0-9.]+'
output: var(cpu_temp)
next: is-cool
is-cool:
tool: if-less
arguments:
left: "{{ cpu_temp }}"
right: "80"
goto:
true: temperature-ok
false: temperature-high
within-bounds:
tool: if-less
arguments:
left: "{{ index }}"
right: "{{ array_length }}"
goto:
true: process-item
false: done-iterating
check-progress:
tool: if-less
arguments:
left: "{{ completed }}"
right: "{{ total }}"
goto:
true: still-working
false: all-done
check-disk-space:
tool: bash
arguments:
command: "df -h / | awk 'NR==2 {print $5}' | tr -d '%'"
output: var(disk_usage)
next: has-space
has-space:
tool: if-less
arguments:
left: "{{ disk_usage }}"
right: "90"
goto:
true: space-available
false: disk-nearly-full
decrement-counter:
tool: bash
arguments:
command: echo "$(( {{ remaining }} - 1 ))"
output: var(remaining)
next: check-remaining
check-remaining:
tool: if-less
arguments:
left: "{{ remaining }}"
right: "1"
goto:
true: countdown-finished
false: decrement-counter