aboutsummaryrefslogtreecommitdiff
path: root/jim_tcl.txt
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2020-12-10 20:05:15 +1000
committerSteve Bennett <steveb@workware.net.au>2020-12-11 22:00:00 +1000
commit0490da395651936d844cce2e32d4972cc2ba985a (patch)
tree3a118717b441eef30618a9db6e2bfe84e709aaf1 /jim_tcl.txt
parenta2816313da54dcadcdb8eecb3875fcc7373432ea (diff)
downloadjimtcl-0490da395651936d844cce2e32d4972cc2ba985a.zip
jimtcl-0490da395651936d844cce2e32d4972cc2ba985a.tar.gz
jimtcl-0490da395651936d844cce2e32d4972cc2ba985a.tar.bz2
list, string: support any number of +/-n for index
It is especially convenient to add -1 for something like: lindex $list end-$BACK-1 or: string range $str $p $p+$len-1 Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim_tcl.txt')
-rw-r--r--jim_tcl.txt12
1 files changed, 7 insertions, 5 deletions
diff --git a/jim_tcl.txt b/jim_tcl.txt
index 73615c6..328aaab 100644
--- a/jim_tcl.txt
+++ b/jim_tcl.txt
@@ -55,6 +55,7 @@ RECENT CHANGES
Changes since 0.80
~~~~~~~~~~~~~~~~~~
1. TIP 582, comments allowed in expressions
+2. Indexes may contain any number of +n, -n
Changes between 0.79 and 0.80
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -655,17 +656,18 @@ The index may be one of the following forms:
A simple integer, where '0' refers to the first element of the string
or list.
-+integer+integer+ or::
-+integer-integer+::
- The sum or difference of the two integers. e.g. +2+3+ refers to the 5th element.
++integer+integer?...?+ or::
++integer-integer?...?+::
+ The sum or difference of the two or more integers. e.g. +2+3-1+ refers to the 4th element.
This is useful when used with (e.g.) +$i+1+ rather than the more verbose
+[expr {$i+1\}]+
+end+::
The last element of the string or list.
-+end-integer+::
- The 'nth-from-last' element of the string or list.
++end-integer?...?+::
+ The 'nth-from-last' element of the string or list. Again, one or more integers may
+ be added or subtracted. e.g. +end-3+1+
COMMAND SUMMARY
---------------