if-less-equal
if-less-equal - check if left value is less than or equal to right value
SYNOPSIS
Section titled “SYNOPSIS”state-name: tool: if-less-equal arguments: left: <number1> right: <number2> goto: true: <le-state> false: <gt-state>DESCRIPTION
Section titled “DESCRIPTION”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.
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”Budget Check
Section titled “Budget Check”check-budget: tool: if-less-equal arguments: left: "{{ spent_amount }}" right: "{{ budget_limit }}" goto: true: within-budget false: over-budgetSize Limit
Section titled “Size Limit”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-largeRate Limit
Section titled “Rate Limit”check-rate: tool: if-less-equal arguments: left: "{{ requests_per_minute }}" right: "100" goto: true: rate-ok false: rate-exceededMaximum Items
Section titled “Maximum Items”check-items: tool: if-less-equal arguments: left: "{{ item_count }}" right: "{{ max_items }}" goto: true: can-add-more false: limit-reachedCOMMON PATTERNS
Section titled “COMMON PATTERNS”Upper Bound Check
Section titled “Upper Bound Check”validate-input: tool: if-less-equal arguments: left: "{{ input_value }}" right: "100" goto: true: input-valid false: input-exceeds-maxConnection Limit
Section titled “Connection Limit”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-connectionsTime Remaining
Section titled “Time Remaining”check-time: tool: if-less-equal arguments: left: "{{ elapsed_seconds }}" right: "{{ timeout_seconds }}" goto: true: still-have-time false: timeout-reachedSEE ALSO
Section titled “SEE ALSO”- if-greater-equal - Greater than or equal
- if-less - Strictly less than
- if-greater - Strictly greater than