Operator Reference

Use the tabs on the upper right to switch to a different programming language.

Use the tabs on the upper right to switch to a different programming language.

Use the tabs on the upper right to switch to a different programming language.

Use the tabs on the upper right to switch to a different programming language.

breakbreakBreakBreakbreak (Operator)

breakbreakBreakBreakbreak — Terminate loop execution or leave a switchswitchSwitchSwitchswitch block.

Signature

break( : : : )

Herror break()

Herror T_break()

void Break()

static void HOperatorSet.Break()

def break() -> None

Description

breakbreakBreakBreakbreak terminates the smallest enclosing forforForForfor, whilewhileWhileWhilewhile, or repeatrepeatRepeatRepeatrepeat..untiluntilUntilUntiluntil loop. In addition, the breakbreakBreakBreakbreak statement is used to leave a switchswitchSwitchSwitchswitch block, in particular at the end of a casecaseCaseCasecase branch. The program execution is continued at the program line following the corresponding block.

breakbreakBreakBreakbreak statements that are not enclosed by a loop or switchswitchSwitchSwitchswitch block are invalid.

Example (HDevelop)

read_image (Image, 'monkey')
threshold (Image, Region, 160, 180)
connection (Region, Regions)
Number := |Regions|
AllRegionsValid := 1
* check if for all regions area <=30
for i := 1 to Number by 1
  select_obj (Regions, ObjectSelected, i)
  area_center (ObjectSelected, Area, Row, Column)
  if (Area > 30)
    AllRegionsValid := 0
    break
  endif
endfor

Result

breakbreakBreakBreakbreak (as an operator) always returns 2 ( H_MSG_TRUE) .

Alternatives

continuecontinueContinueContinuecontinue

See also

forforForForfor, whilewhileWhileWhilewhile, repeatrepeatRepeatRepeatrepeat, untiluntilUntilUntiluntil, switchswitchSwitchSwitchswitch, casecaseCaseCasecase

Module

Foundation