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 (算子名称)

名称

breakbreakBreakBreakbreak — Terminate loop execution or leave a switchswitchSwitchSwitchSwitchswitch block.

参数签名

break( : : : )

Herror break()

Herror T_break()

void Break()

static void HOperatorSet.Break()

def break() -> None

描述

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.

例程 (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

结果

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

可替代算子

continuecontinueContinueContinueContinuecontinue

参考其它

forforForForForfor, whilewhileWhileWhileWhilewhile, repeatrepeatRepeatRepeatRepeatrepeat, untiluntilUntilUntilUntiluntil, switchswitchSwitchSwitchSwitchswitch, casecaseCaseCaseCasecase

模块

Foundation