break

Leaves the innermost loop when the value is true.

Value

ValueTypeDefaultDescription
the command's valuedynamic stringBreaks out of the innermost loop when the value is true. Only allowed inside 'for' and 'while'.

Example

"for": {
  "iter": "{ candidates }",
  "loopVar": "cand",
  "do": {
    "var": { "match": "{ cand }" },
    "break": "{ cand['score'] > 0.9 }"
  }
}

Rules

  • The value is evaluated as a boolean. A literal "{ True }" always breaks.
  • break is allowed only inside a for or while block, including inside an if within the loop. Anywhere else the agent fails validation.
  • Only the innermost loop is left.