📄 if.n
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1996 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: @(#) if.n 1.7 96/08/26 13:00:00'\" .so man.macros.TH if n "" Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEif \- Execute scripts conditionally.SH SYNOPSIS\fBif \fIexpr1 \fR?\fBthen\fR? \fIbody1 \fBelseif \fIexpr2 \fR?\fBthen\fR? \fIbody2\fR \fBelseif\fR ... ?\fBelse\fR? ?\fIbodyN\fR?.BE.SH DESCRIPTION.PPThe \fIif\fR command evaluates \fIexpr1\fR as an expression (in thesame way that \fBexpr\fR evaluates its argument). The value of theexpression must be a boolean(a numeric value, where 0 is false andanything is true, or a string value such as \fBtrue\fR or \fByes\fRfor true and \fBfalse\fR or \fBno\fR for false);if it is true then \fIbody1\fR is executed by passing it to theTcl interpreter.Otherwise \fIexpr2\fR is evaluated as an expression and if it is truethen \fBbody2\fR is executed, and so on.If none of the expressions evaluates to true then \fIbodyN\fR isexecuted.The \fBthen\fR and \fBelse\fR arguments are optional``noise words'' to make the command easier to read.There may be any number of \fBelseif\fR clauses, including zero.\fIBodyN\fR may also be omitted as long as \fBelse\fR is omitted too.The return value from the command is the result of the body scriptthat was executed, or an empty stringif none of the expressions was non-zero and there was no \fIbodyN\fR..SH KEYWORDSboolean, conditional, else, false, if, true
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -