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)

Name

breakbreakBreakBreakbreak — Terminate loop execution or leave a switchswitchSwitchSwitchSwitchswitch block.

Signature

break( : : : )

Herror break()

Herror T_break()

void Break()

static void HOperatorSet.Break()

def break() -> None

Description

breakbreakBreakBreakBreakbreak terminates the smallest enclosing forforForForForfor, whilewhileWhileWhileWhilewhile, or repeatrepeatRepeatRepeatRepeatrepeat..untiluntilUntilUntilUntiluntil loop. In addition, the breakbreakBreakBreakBreakbreak statement is used to leave a switchswitchSwitchSwitchSwitchswitch block, in particular at the end of a casecaseCaseCaseCasecase branch. The program execution is continued at the program line following the corresponding block.

breakbreakBreakBreakBreakbreak statements that are not enclosed by a loop or switchswitchSwitchSwitchSwitchswitch 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

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

Alternatives

continuecontinueContinueContinueContinuecontinue

See also

forforForForForfor, whilewhileWhileWhileWhilewhile, repeatrepeatRepeatRepeatRepeatrepeat, untiluntilUntilUntilUntiluntil, switchswitchSwitchSwitchSwitchswitch, casecaseCaseCaseCasecase

Module

Foundation