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.

breakbreakBreakBreak (Operator)

Name

breakbreakBreakBreak — Terminate loop execution or leave a switchswitchSwitchSwitchSwitch block.

Signature

break( : : : )

Herror break()

Herror T_break()

void Break()

static void HOperatorSet.Break()

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