diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-27 09:36:58 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-27 09:36:58 (GMT) |
commit | cd7e7ec95e76bcb5bf66d7cc9e6d60aad70dba07 (patch) | |
tree | 2f66883fc243d05145536a48036f61275d482016 /doc/expr.n | |
parent | dfe0bb63c25ec4b9669b67071a6540448d5a7379 (diff) | |
download | tcl-cd7e7ec95e76bcb5bf66d7cc9e6d60aad70dba07.zip tcl-cd7e7ec95e76bcb5bf66d7cc9e6d60aad70dba07.tar.gz tcl-cd7e7ec95e76bcb5bf66d7cc9e6d60aad70dba07.tar.bz2 |
Many minor doc fixes
Diffstat (limited to 'doc/expr.n')
-rw-r--r-- | doc/expr.n | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -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" |