aboutsummaryrefslogtreecommitdiff
path: root/jim_tcl.txt
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2020-12-25 08:19:54 +1000
committerSteve Bennett <steveb@workware.net.au>2020-12-26 18:08:30 +1000
commit0127e81ddcc824d2985e5c63dd2942689b5d39e3 (patch)
treed5f9ba387846cc30960cdf513931c3c0b0825dd3 /jim_tcl.txt
parent5283ac52f4b93748b5aac560cd26ae0a71153a63 (diff)
downloadjimtcl-0127e81ddcc824d2985e5c63dd2942689b5d39e3.zip
jimtcl-0127e81ddcc824d2985e5c63dd2942689b5d39e3.tar.gz
jimtcl-0127e81ddcc824d2985e5c63dd2942689b5d39e3.tar.bz2
loop: Allow start value to be omitted
It is convenient to be able to do just: loop i 5 { body } Where the start value is 0. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim_tcl.txt')
-rw-r--r--jim_tcl.txt6
1 files changed, 4 insertions, 2 deletions
diff --git a/jim_tcl.txt b/jim_tcl.txt
index 1a2b18a..24ea60b 100644
--- a/jim_tcl.txt
+++ b/jim_tcl.txt
@@ -58,6 +58,7 @@ Changes since 0.80
2. Many commands now accept "safe" integer expressions rather than simple integers:
`loop`, `range`, `incr`, `string repeat`, `lrepeat`, `pack`, `unpack`, `rand`
3. String and list indexes now accept integer expressions (<<_string_and_list_index_specifications,STRING AND LIST INDEX SPECIFICATIONS>>)
+4. `loop` can now omit start value
Changes between 0.79 and 0.80
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3068,7 +3069,7 @@ Also see `defer` as another mechanism for cleaning up at the end of a procedure.
loop
~~~~
-+*loop* 'var first limit ?incr? body'+
++*loop* 'var ?first? limit ?incr? body'+
Similar to `for` except simpler and possibly more efficient.
If +'incr'+ is positive, the effect is, equivalent to:
@@ -3079,11 +3080,12 @@ If +'incr'+ is positive, the effect is, equivalent to:
While if +'incr'+ is negative, the count is downwards.
+If +'first'+ is not specified, 0 is used.
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.
++'first'+, +'limit'+ and +'incr'+ may be any integer expression.
lindex
~~~~~~