2 Copyright (c) 2000-2016 Ericsson Telecom AB
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Eclipse Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/epl-v10.html
16 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
17 <meta http-equiv=
"Content-Language" content=
"en-us">
20 <body bgcolor=
"#DAD3C5" vlink=
"#0094D2" link=
"#003258">
21 <table align=
"left" border=
"0" cellspacing=
"0" cellpadding=
"0" valign=top
>
23 <td width=
105 height=
40><a href=
"https://projects.eclipse.org/projects/tools.titan"><img src=
"../images/titan_transparent.gif" border=
0 width=
105 height=
40 align=
"left" alt=
"Titan"></a></td>
26 <table border=
"0" align=
"right" cellpadding=
"0" cellspacing=
"0">
28 <td><a href=
"../titan_main.html" alt=
"contents"><img border=
"0" src=
"../images/ao.jpg" width=
"53" height=
"40"></a></td>
29 <td><a href=
"../titan_index.html" alt=
"index"><img border=
"0" src=
"../images/up.jpg" width=
"53" height=
"40"></a></td>
30 <td><a href=
"boolean.html" alt=
"previous"><img border=
"0" src=
"../images/left.jpg" width=
"53" height=
"40"></a></td>
31 <td><a href=
"call.html" alt=
"next"><img border=
"0" src=
"../images/right.jpg" width=
"53" height=
"40"></a></td>
38 <hr align=
"left" width=
"75%">
39 <p>The keyword is used in loops and
<font face=
"Courier New"><b>alt
</b></font>,
<font face=
"Courier New"><b>interleave
</b></font> or
<font face=
"Courier New"><b>call
</b></font> statements and
<font
40 face=
"Courier New"><b>altstep
</b></font> definitions.
</p>
41 <p>The
<font face=
"Courier New"><b>break
</b></font> statement may only be used inside the body of a loop (
<font face=
"Courier New"><b>for
</b></font>,
<font face=
"Courier New"><b>while
</b></font>,
42 <font face=
"Courier New"><b>do-while
</b></font>) or an alternative of an
<font face=
"Courier New"><b>alt
</b></font> or
<font face=
"Courier New"><b>interleave
</b></font> statement or response and
43 exception handling parts of a
<font face=
"Courier New"><b>call
</b></font> statement or the statement block of an alternative of an
<font face=
"Courier New"><b>altstep
</b></font> definition.
</p>
44 <p>When used in loops or
<font face=
"Courier New"><b>alt
</b></font>,
<font face=
"Courier New"><b>interleave
</b></font> or
<font face=
"Courier New"><b>call
</b></font> statements:
<br>
45 On executing a
<font face=
"Courier New"><b>break
</b></font> statement the innermost, currently executed loop,
<font face=
"Courier New"><b>alt
</b></font>,
<font face=
"Courier New"><b>interleave
</b></font>
46 or
<font face=
"Courier New"><b>call
</b></font> statement is left. Execution continues with the statement following the construct which is left.
</p>
47 <p>When used in
<font face=
"Courier New"><b>altstep
</b></font> definitions (but not inside a loop or an
<font face=
"Courier New"><b>alt
</b></font>,
<font face=
"Courier New"><b>interleave
</b></font>
48 or
<font face=
"Courier New"><b>call
</b></font> statement):
<br>
49 On executing a
<font face=
"Courier New"><b>break
</b></font> statement the
<font face=
"Courier New"><b>altstep
</b></font> is left. If the
<font face=
"Courier New"><b>altstep
</b></font> was explicitly
50 called as an alternative of an
<font face=
"Courier New"><b>alt
</b></font> statement or it was called as default for an
<font face=
"Courier New"><b>alt
</b></font> statement, then the
<font
51 face=
"Courier New"><b>alt
</b></font> statement is also left. If the
<font face=
"Courier New"><b>altstep
</b></font> was explicitly called as an alternative with a statement block, then the statement
52 block is skipped (and the
<font face=
"Courier New"><b>alt
</b></font> statement is left).
</p>
53 <hr align=
"left" width=
"50%">
54 <p>Related keyword:
</p>
56 <li><a href=
"for.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">for
</font></b></a></li>
57 <li><a href=
"while.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">while
</font></b></a></li>
58 <li><a href=
"do.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">do-while
</font></b></a></li>
59 <li><a href=
"alt.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">alt
</font></b></a></li>
60 <li><a href=
"interleave.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">interleave
</font></b></a></li>
61 <li><a href=
"call.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">call
</font></b></a></li>
62 <li><a href=
"altstep.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">altstep
</font></b></a></li>
64 <hr align=
"left" width=
"50%">
67 <table border=
"0" width=
"90%" bgcolor=
"#FFB599" cellpadding=
"4">
70 <h3 align=
"center"><font face=
"Courier New" color=
"#003258" size=
"5"><b>break;
</b></font></h3>
76 <hr align=
"left" width=
"25%">
79 /* ... */
<br>
80 if (cond1) { break; /* the do-while loop is left */ }
<br>
81 /* ... */
<br>
82 for (var integer j:=
1; j<=
10; j:= j+
1) {
<br>
83 /* ... */
<br>
84 if (cond2) { break; /* the for-loop is left but the do-while loop is continued */ }
<br>
85 /* ... */
<br>
87 /* ... */
<br>
90 <hr align=
"left" width=
"25%">
92 <p><code> interleave {
<br>
93 [] PCO1.receive(integer:?) { /* do something here */ }
<br>
94 [] PCO2.receive(integer:?) { /* do something here, too */ }
<br>
95 [] T.timeout { break; }
<br>
98 <p>With the usage of the
<font face=
"Courier New"><b>break
</b></font> statement a time limit for the execution of the
<font face=
"Courier New"><b>interleave
</b></font> statement is implemented.
</p>
99 <hr align=
"left" width=
"25%">
100 <p><a HREF=
"BNF.html#breakstatement">BNF definition
</a> of
<font face=
"Courier New">break
</font></p>