1.. _cmd-break:
2
3break - stop the current inner loop
4===================================
5
6Synopsis
7--------
8
9::
10
11    LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end
12
13
14Description
15-----------
16
17``break`` halts a currently running loop, such as a :ref:`switch <cmd-switch>`, :ref:`for <cmd-for>` or :ref:`while <cmd-while>` loop. It is usually added inside of a conditional block such as an :ref:`if <cmd-if>` block.
18
19There are no parameters for ``break``.
20
21
22Example
23-------
24The following code searches all .c files for "smurf", and halts at the first occurrence.
25
26::
27
28    for i in *.c
29        if grep smurf $i
30            echo Smurfs are present in $i
31            break
32        end
33    end
34
35See Also
36--------
37
38- the :ref:`continue <cmd-continue>` command, to skip the remainder of the current iteration of the current inner loop
39