Debian Codegraph @

doc/break.n

raw
1 '\"
2 '\" Copyright (c) 1993-1994 The Regents of the University of California.
3 '\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4 '\"
5 '\" See the file "license.terms" for information on usage and redistribution
6 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 '\"
8 .TH break n "" Tcl "Tcl Built-In Commands"
9 .so man.macros
10 .BS
11 '\" Note: do not modify the .SH NAME line immediately below!
12 .SH NAME
13 break \- Abort looping command
14 .SH SYNOPSIS
15 \fBbreak\fR
16 .BE
17 .SH DESCRIPTION
18 .PP
19 This command is typically invoked inside the body of a looping command
20 such as \fBfor\fR or \fBforeach\fR or \fBwhile\fR.
21 It returns a 3 (\fBTCL_BREAK\fR) result code, which causes a break exception
22 to occur.
23 The exception causes the current script to be aborted
24 out to the innermost containing loop command, which then
25 aborts its execution and returns normally.
26 Break exceptions are also handled in a few other situations, such
27 as the \fBcatch\fR command, Tk event bindings, and the outermost
28 scripts of procedure bodies.
29 .SH EXAMPLE
30 .PP
31 Print a line for each of the integers from 0 to 5:
32 .PP
33 .CS
34 for {set x 0} {$x<10} {incr x} {
35 if {$x > 5} {
36 \fBbreak\fR
37 }
38 puts "x is $x"
39 }
40 .CE
41 .SH "SEE ALSO"
42 catch(n), continue(n), for(n), foreach(n), return(n), while(n)
43 .SH KEYWORDS
44 abort, break, loop
45 '\" Local Variables:
46 '\" mode: nroff
47 '\" End: