Skip to content

if-less-equal

if-less-equal - check if left value is less than or equal to right value

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

The if-less-equal tool performs a numeric comparison and returns "true" if the left value is less than or equal to 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-budget:
tool: if-less-equal
arguments:
left: "{{ spent_amount }}"
right: "{{ budget_limit }}"
goto:
true: within-budget
false: over-budget
check-file-size:
tool: bash
arguments:
command: stat -f %z upload.zip
output: var(file_size)
next: check-size
check-size:
tool: if-less-equal
arguments:
left: "{{ file_size }}"
right: "10485760" # 10MB
goto:
true: size-ok
false: file-too-large
check-rate:
tool: if-less-equal
arguments:
left: "{{ requests_per_minute }}"
right: "100"
goto:
true: rate-ok
false: rate-exceeded
check-items:
tool: if-less-equal
arguments:
left: "{{ item_count }}"
right: "{{ max_items }}"
goto:
true: can-add-more
false: limit-reached
validate-input:
tool: if-less-equal
arguments:
left: "{{ input_value }}"
right: "100"
goto:
true: input-valid
false: input-exceeds-max
check-connections:
tool: bash
arguments:
command: netstat -an | grep ESTABLISHED | wc -l
output: var(connections)
next: check-limit
check-limit:
tool: if-less-equal
arguments:
left: "{{ connections }}"
right: "1000"
goto:
true: connections-ok
false: too-many-connections
check-time:
tool: if-less-equal
arguments:
left: "{{ elapsed_seconds }}"
right: "{{ timeout_seconds }}"
goto:
true: still-have-time
false: timeout-reached