OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [doc/] [if.n] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1993 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
'\" RCS: @(#) $Id: if.n,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $
9
'\"
10
.so man.macros
11
.TH if n "" Tcl "Tcl Built-In Commands"
12
.BS
13
'\" Note:  do not modify the .SH NAME line immediately below!
14
.SH NAME
15
if \- Execute scripts conditionally
16
.SH SYNOPSIS
17
\fBif \fIexpr1 \fR?\fBthen\fR? \fIbody1 \fBelseif \fIexpr2 \fR?\fBthen\fR? \fIbody2\fR \fBelseif\fR ... ?\fBelse\fR? ?\fIbodyN\fR?
18
.BE
19
 
20
.SH DESCRIPTION
21
.PP
22
The \fIif\fR command evaluates \fIexpr1\fR as an expression (in the
23
same way that \fBexpr\fR evaluates its argument).  The value of the
24
expression must be a boolean
25
(a numeric value, where 0 is false and
26
anything is true, or a string value such as \fBtrue\fR or \fByes\fR
27
for true and \fBfalse\fR or \fBno\fR for false);
28
if it is true then \fIbody1\fR is executed by passing it to the
29
Tcl interpreter.
30
Otherwise \fIexpr2\fR is evaluated as an expression and if it is true
31
then \fBbody2\fR is executed, and so on.
32
If none of the expressions evaluates to true then \fIbodyN\fR is
33
executed.
34
The \fBthen\fR and \fBelse\fR arguments are optional
35
``noise words'' to make the command easier to read.
36
There may be any number of \fBelseif\fR clauses, including zero.
37
\fIBodyN\fR may also be omitted as long as \fBelse\fR is omitted too.
38
The return value from the command is the result of the body script
39
that was executed, or an empty string
40
if none of the expressions was non-zero and there was no \fIbodyN\fR.
41
 
42
.SH KEYWORDS
43
boolean, conditional, else, false, if, true

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.