The "Unknown:"s below indicate that an entry is incomplete.
{ ... } | block (grouping statements, especially when statements are not expressions) |
"..." | block (grouping statements, especially when statements are not expressions) |
\ | breaking lines (useful when end-of-line and/or indentation has a special meaning) |
# | commenting (until end of line) |
< > <= >= | comparison |
string compare | comparison (returns 3 values (i.e. inferior, equal or superior)) |
== != | equality / inequality (deep) |
( ... ) | grouping expressions |
eval | runtime evaluation |
[...] | runtime evaluation |
case-sensitive | tokens (case-sensitivity (keywords, variable identifiers...)) |
[^ \t\n\r\f]+ | tokens (function identifier regexp (if different from variable identifier regexp)) |
[_a-zA-Z][_a-zA-Z0-9]* | tokens (variable identifier regexp) |
CamelCase or camelCase | tokens (what is the standard way for scrunching together multiple words) |
set, variable | variable assignment or declaration (both) |
interp alias {} f_a {} f a | partial application (in the examples below, a normal call is "f(a,b)") (give the first argument) |
f a b ... | function call |
f | function call (with no parameter) |
unknown | function called when a function is not defined (in dynamic languages) |
proc f {para1 para2} { ... } | function definition |
return(1) | function return value (breaks the control flow) |
no syntax needed(2) | function return value (function body is the result) |
info level | runtime inspecting the caller information |
Unknown:
anonymous function
continue / break | breaking control flow (continue / break) |
return(1) | breaking control flow (returning a value) |
catch | exception (catching) |
return -code | exception (throwing) |
if c then ... | if_then |
if c ... | if_then |
if c b1 elsif c2 b2 b3 | if_then_else |
if c then b1 elseif c2 then b2 else b3 | if_then_else |
c ? b1 : b2 | if_then_else |
for | loop (for "a la C" (while + initialisation)) |
for {set i 10} {$i >= 1} {incr i -1} {...} | loop (for each value in a numeric range, 1 decrement) |
for {set i 1} {$i <= 10} {incr i} {...} | loop (for each value in a numeric range, 1 increment (see also the entries about ranges)) |
for {set i 0} {$i <= 10} {incr i 2} {...} | loop (for each value in a numeric range, free increment) |
while c ... | loop (while condition do something) |
switch val { v1 {...} v2 - v3 {...} default {...} } | multiple selection (switch) |
; | sequence |
end-of-line | sequence |
object method para | method invocation |
namespace eval p ... | declare |
namespace export name1 | declare (selective export) |
namespace import p * | import (everything into current namespace) |
package require p | import (package (ie. load the package)) |
namespace import p name1 | import (selectively) |
:: | package scope |
string index s n | accessing n-th character |
format %c $c | ascii to character |
scan $s %c | character to ascii |
unneeded, all values are strings | convert something to a string (see also string interpolation) |
string repeat | duplicate n times |
string range | extract a substring |
string first | locate a substring |
string last | locate a substring (starting at the end) |
"...", {...} | multi-line |
puts(3) | simple print (on simple objects) |
puts -nonewline | simple print (on simple objects) |
puts | simple print (on strings) |
format | sprintf-like |
$a$b | string concatenation |
eq ne | string equality & inequality |
string length | string size |
\n | strings (end-of-line (without writing the real CR or LF character)) |
...(4) | strings (with interpolation of variables) |
"... $v ..." | strings (with interpolation of variables) |
{...{...}...} | strings (with no interpolation of variables) |
string toupper / string tolower | upper / lower case character |
string toupper / string tolower / string totitle | uppercase / lowercase / capitalized string |
false | false value |
no | false value |
off | false value |
0(5) | false value |
! | logical not |
|| / && | logical or / and (short circuit) |
true | true value |
yes | true value |
on | true value |
non zero number | true value |
linsert l i e | adding an element at index (return the new list (no side-effect)) |
linsert l end e | adding an element at the end (return the new list (no side-effect)) |
lappend | adding an element at the end (side-effect) |
lrange l 1 end | all but the first element |
lsearch -exact | find an element |
foreach | for each element do something |
join l s | join a list of strings in a string using a glue string |
lindex l end | last element |
concat | list concatenation |
list | list constructor |
eval concat | list flattening (one level depth) |
array get | list out of a bag |
llength | list size |
lindex | list/array indexing |
lsort -unique | remove duplicates |
lsort | sort |
Unknown:
transform a list (or bag) in another one
transform two lists in parallel
is an element in the list
is the predicate true for an element
is the predicate true for every element
f(... f(f(init, e1), e2) ..., en)
h(k) | dictionary (access: read/write) |
Unknown:
optional value (null value)
optional value (value)
optional value (null coalescing)
record (selector)
range
+ / - / * / / | addition / subtraction / multiplication / division |
& / | / ^ | bitwise operators (and / or / xor) |
~ | bitwise operators (bitwise inversion) |
<< / >> | bitwise operators (left shift / right shift / unsigned right shift) |
pow | exponentiation (power) |
log10 | logarithm (base 10) |
log | logarithm (base e) |
% | modulo (modulo of -3 / 2 is 1) |
- | negation |
1000., 1E3 | numbers syntax (floating point) |
07, 0xf | numbers syntax (integers in base 2, octal and hexadecimal) |
1000 | numbers syntax (integers) |
mathematical | operator priorities and associativities (addition vs multiplication) |
rand | random (random number) |
srand | random (seed the pseudo random generator) |
sqrt / exp / abs | square root / e-exponential / absolute value |
sin / cos / tan | trigonometry (basic) |
asin / acos / atan(6) | trigonometry (inverse) |
/ round / floor / ceil | truncate / round / floor / ceil |
thread::mutex | Thread Synchronization (Defining a Synchronized Shared Resource) |
thread send $t {script} | starting / stopping threads |
set t [thread create {code}] | thread creation |