📄 case.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: @(#) case.n 1.8 96/03/25 20:10:49'\" .so man.macros.TH case n 7.0 Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEcase \- Evaluate one of several scripts, depending on a given value.SH SYNOPSIS\fBcase\fI string \fR?\fBin\fR? \fIpatList body \fR?\fIpatList body \fR...?.sp\fBcase\fI string \fR?\fBin\fR? {\fIpatList body \fR?\fIpatList body \fR...?}.BE.SH DESCRIPTION.PP\fINote: the \fBcase\fI command is obsolete and is supported onlyfor backward compatibility. At some point in the future it may beremoved entirely. You should use the \fBswitch\fI command instead.\fR.PPThe \fBcase\fR command matches \fIstring\fR against each ofthe \fIpatList\fR arguments in order.Each \fIpatList\fR argument is a list of one ormore patterns. If any of these patterns matches \fIstring\fR then\fBcase\fR evaluates the following \fIbody\fR argumentby passing it recursively to the Tcl interpreter and returns the resultof that evaluation.Each \fIpatList\fR argument consists of a singlepattern or list of patterns. Each pattern may contain any of the wild-cardsdescribed under \fBstring match\fR. If a \fIpatList\fRargument is \fBdefault\fR, the corresponding body will be evaluatedif no \fIpatList\fR matches \fIstring\fR. If no \fIpatList\fR argumentmatches \fIstring\fR and no default is given, then the \fBcase\fRcommand returns an empty string..PPTwo syntaxes are provided for the \fIpatList\fR and \fIbody\fR arguments.The first uses a separate argument for each of the patterns and commands;this form is convenient if substitutions are desired on some of thepatterns or commands.The second form places all of the patterns and commands together intoa single argument; the argument must have proper list structure, withthe elements of the list being the patterns and commands.The second form makes it easy to construct multi-line case commands,since the braces around the whole list make it unnecessary to include abackslash at the end of each line.Since the \fIpatList\fR arguments are in braces in the second form,no command or variable substitutions are performed on them; this makesthe behavior of the second form different than the first form in somecases..SH KEYWORDScase, match, regular expression
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -