Tcl Tk
Advanced Search
Mail us
Home    Manuel    Links    Faq    Submit a tcl/tk Reference    Contact Us

    Some examples tcl/tk codes     Man of Bwidget     Man of blt     mkwidget screenshots     TkOgl     Video Demo real.


The source of theses pages is the excellent Tcl/Tk Quick Reference Guide.
I apologize , because there're some tex commands in the text, if you see some error please send me an email

Operators and Expressions


The expr command recognizes the following operators, in decreasing order of precedence:
- ~ ! unary minus, bitwise NOT, logical NOT
* / % multiply, divide, remainder
+ - add, subtract
bitwise shift left, bitwise shift right
= = boolean comparisons
== != boolean equals, not equals
& bitwise AND
${}^wedge$ bitwise exclusive OR
bitwise inclusive OR
&& logical AND
\ logical OR
x ? y : z if x != 0, then y, else z
All operators support integers. All support floating point except ~, \%, ltlt, gtgt, &, ${}^wedge$, and . Boolean operators can also be used for string operands, in which case string comparison will be used. This will occur if any of the operands are not valid numbers. The &&, \, and ?: operators have ``lazy evaluation``, as in C. Possible operands are numeric values, Tcl variables (with $), strings in double quotes or braces, Tcl comands in brackets, and the following math functions: { t
abs ceil floor log10 sinh
acos cos fmod pow sqrt
asin cosh hypot rand srand
atan double int round tan
atan2 exp log sin tanh
}

The source of theses pages is the excellent Tcl/Tk Quick Reference Guide.