Files
mql5-skills/skills/mql5/references/docs/00-basis/0044-basis-operators-break.md
T
2026-06-23 21:47:51 +08:00

18 lines
831 B
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Break Operator
The break operator terminates the execution of the nearest nested outward [switch](/en/docs/basis/operators/switch), [while](/en/docs/basis/operators/while), [do-while](/en/docs/basis/operators/dowhile) or [for](/en/docs/basis/operators/for) operator. The control is passed to the operator that follows the terminated one. One of the purposes of this operator is to finish the looping execution when a certain value is assigned to a variable.
Example:
```
//--- searching for the first zero element
for(i=0;i<array_size;i++)
  if(array[i]==0)
    break;
```
See also
[Initialization of Variables](/en/docs/basis/variables/initialization), [Visibility Scope and Lifetime of Variables](/en/docs/basis/variables/variable_scope), [Creating and Deleting Objects](/en/docs/basis/variables/object_live)