if-less
if-less - check if left value is less than right value
SYNOPSIS
Section titled “SYNOPSIS”state-name: tool: if-less arguments: left: <number1> right: <number2> goto: true: <less-state> false: <not-less-state>DESCRIPTION
Section titled “DESCRIPTION”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.
ARGUMENTS
Section titled “ARGUMENTS”| Argument | Required | Default | Description |
|---|---|---|---|
left | Yes | - | The number to compare (left side) |
right | Yes | - | The number to compare against (right side) |
EXIT CODES
Section titled “EXIT CODES”| Code | Meaning |
|---|---|
0 | Success (outputs “true” or “false”) |
1 | Missing argument or invalid number |
OUTPUT
Section titled “OUTPUT”The tool outputs "true" if left < right, or "false" otherwise.
EXAMPLES
Section titled “EXAMPLES”Loop Control
Section titled “Loop Control”check-iteration: tool: if-less arguments: left: "{{ current_iteration }}" right: "{{ max_iterations }}" goto: true: continue-loop false: exit-loopCapacity Check
Section titled “Capacity Check”check-capacity: tool: if-less arguments: left: "{{ current_count }}" right: "{{ max_capacity }}" goto: true: has-capacity false: at-capacityTemperature Check
Section titled “Temperature Check”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-highIndex Check
Section titled “Index Check”within-bounds: tool: if-less arguments: left: "{{ index }}" right: "{{ array_length }}" goto: true: process-item false: done-iteratingCOMMON PATTERNS
Section titled “COMMON PATTERNS”Progress Check
Section titled “Progress Check”check-progress: tool: if-less arguments: left: "{{ completed }}" right: "{{ total }}" goto: true: still-working false: all-doneResource Availability
Section titled “Resource Availability”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-fullCountdown
Section titled “Countdown”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-counterSEE ALSO
Section titled “SEE ALSO”- if-greater - Greater than comparison
- if-less-equal - Less than or equal
- if-greater-equal - Greater than or equal
- for-each - Loop over items