summaryrefslogtreecommitdiffstats
path: root/doc/expr.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/expr.n')
-rw-r--r--doc/expr.n30
1 files changed, 15 insertions, 15 deletions
diff --git a/doc/expr.n b/doc/expr.n
index d3135c8..6779c93 100644
--- a/doc/expr.n
+++ b/doc/expr.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: expr.n,v 1.17 2004/10/26 10:24:59 dkf Exp $
+'\" RCS: @(#) $Id: expr.n,v 1.18 2004/10/27 09:36:58 dkf Exp $
'\"
.so man.macros
.TH expr n 8.5 Tcl "Tcl Built-In Commands"
@@ -89,7 +89,7 @@ functions.
.LP
Where the above substitutions occur (e.g. inside quoted strings), they
are performed by the expression's instructions.
-However, the command parser may already have performed one layer of
+However, the command parser may already have performed one round of
substitution before the expression processor was called.
As discussed below, it is usually best to enclose expressions
in braces to prevent the command parser from performing substitutions
@@ -431,42 +431,42 @@ Define a procedure that computes an "interesting" mathematical
function:
.CS
proc calc {x y} {
- expr { ($x**2 - $y**2) / exp($x**2 + $y**2) }
+ \fBexpr\fR { ($x**2 - $y**2) / exp($x**2 + $y**2) }
}
.CE
-
+.PP
Convert polar coordinates into cartesian coordinates:
.CS
# convert from ($radius,$angle)
-set x [expr { $radius * cos($angle) }]
-set y [expr { $radius * sin($angle) }]
+set x [\fBexpr\fR { $radius * cos($angle) }]
+set y [\fBexpr\fR { $radius * sin($angle) }]
.CE
-
+.PP
Convert cartesian coordinates into polar coordinates:
.CS
# convert from ($x,$y)
-set radius [expr { hypot($y, $x) }]
-set angle [expr { atan2($y, $x) }]
+set radius [\fBexpr\fR { hypot($y, $x) }]
+set angle [\fBexpr\fR { atan2($y, $x) }]
.CE
-
+.PP
Print a message describing the relationship of two string values to
each other:
.CS
-puts "a and b are [expr {$a eq $b ? {equal} : {different}}]"
+puts "a and b are [\fBexpr\fR {$a eq $b ? {equal} : {different}}]"
.CE
-
+.PP
Set a variable to whether an environment variable is both defined at
all and also set to a true boolean value:
.CS
-set isTrue [expr {
+set isTrue [\fBexpr\fR {
[info exists ::env(SOME_ENV_VAR)] &&
[string is true -strict $::env(SOME_ENV_VAR)]
}]
.CE
-
+.PP
Generate a random integer in the range 0..99 inclusive:
.CS
-set randNum [expr { int(100 * rand()) }]
+set randNum [\fBexpr\fR { int(100 * rand()) }]
.CE
.SH "SEE ALSO"