📄 while.n
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) while.n 1.7 97/04/08 17:13:50'\" .so man.macros.TH while n "" Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEwhile \- Execute script repeatedly as long as a condition is met.SH SYNOPSIS\fBwhile \fItest body\fR.BE.SH DESCRIPTION.PPThe \fBwhile\fR command evaluates \fItest\fR as an expression(in the same way that \fBexpr\fR evaluates its argument).The value of the expression must a proper booleanvalue; if it is a true valuethen \fIbody\fR is executed by passing it to the Tcl interpreter.Once \fIbody\fR has been executed then \fItest\fR is evaluatedagain, and the process repeats until eventually \fItest\fRevaluates to a false boolean value. \fBContinue\fRcommands may be executed inside \fIbody\fR to terminate the currentiteration of the loop, and \fBbreak\fRcommands may be executed inside \fIbody\fR to cause immediatetermination of the \fBwhile\fR command. The \fBwhile\fR commandalways returns an empty string..PPNote: \fItest\fR should almost always be enclosed in braces. If not,variable substitutions will be made before the \fBwhile\fRcommand starts executing, which means that variable changesmade by the loop body will not be considered in the expression.This is likely to result in an infinite loop. If \fItest\fR isenclosed in braces, variable substitutions are delayed until theexpression is evaluated (beforeeach loop iteration), so changes in the variables will be visible.For an example, try the following script with and without the bracesaround \fB$x<10\fR:.CSset x 0while {$x<10} { puts "x is $x" incr x}.CE.SH KEYWORDSboolean value, loop, test, while
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -