diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-12-19 09:31:40 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-12-26 18:08:29 +1000 |
commit | ea1b12824f360ca2f3b4838e1d88605b9b1c1a6d (patch) | |
tree | da9cc972a7fedcfe45eaa068636345013c785d12 /jim_tcl.txt | |
parent | a905122e48ae2f5208b037d8bfc08631b753cb63 (diff) | |
download | jimtcl-ea1b12824f360ca2f3b4838e1d88605b9b1c1a6d.zip jimtcl-ea1b12824f360ca2f3b4838e1d88605b9b1c1a6d.tar.gz jimtcl-ea1b12824f360ca2f3b4838e1d88605b9b1c1a6d.tar.bz2 |
core: support integer expressions in various commands
For convenience, many commands now accept integer expressions
rather than only simple integers.
These are:
loop, range, incr, string repeat, lrepeat, pack, unpack, rand
This simplifies many cases where previously expr {} or $() was required.
e.g.
foreach i [range 4+1 2*$b] { ... }
string repeat 2**$n a
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim_tcl.txt')
-rw-r--r-- | jim_tcl.txt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/jim_tcl.txt b/jim_tcl.txt index 328aaab..b76f9ab 100644 --- a/jim_tcl.txt +++ b/jim_tcl.txt @@ -56,6 +56,8 @@ Changes since 0.80 ~~~~~~~~~~~~~~~~~~ 1. TIP 582, comments allowed in expressions 2. Indexes may contain any number of +n, -n +3. Many commands now accept integer expressions rather than simple integers: + `loop`, `range`, `incr`, `string repeat`, `lrepeat`, `pack`, `unpack`, `rand` Changes between 0.79 and 0.80 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2771,7 +2773,7 @@ Increment the value stored in the variable whose name is +'varName'+. The value of the variable must be integral. If +'increment'+ is supplied then its value (which must be an -integer) is added to the value of variable +'varName'+; otherwise +integer expression) is added to the value of variable +'varName'+; otherwise 1 is added to +'varName'+. The new value is stored as a decimal string in variable +'varName'+ @@ -3070,6 +3072,8 @@ If +'incr'+ is not specified, 1 is used. Note that setting the loop variable inside the loop does not affect the loop count. +Integer parameters may be any integer expression. + lindex ~~~~~~ +*lindex* 'list ?index ...?'+ @@ -3594,6 +3598,8 @@ and ranging up to but not including +'end'+ in steps of +'step'+ defaults to 1). 7 5 ---- +Integer parameters may be any integer expression. + read ~~~~ +*read* ?*-nonewline*? 'fileId'+ |