I'd like to elaborate on the glenn's post to make things more clear for Vahagn.
expr
does not return its result in one representation or another, instead, it returns a value in some suitable internal format (an integer, a big integer, a floating point value etc). What you see doing your testing is just Tcl interpreter converting what expr
returned to an appropriate textual form using a default conversion to a string which, for integers, naturally uses base 10.
This conversion takes place in your case solely because you wanted to display the value returned by expr
, and displaying of (any) values naturally tends to convert them to strings if they are "printed"—to a terminal, to a tkcon's window etc.
By using format
you enforce whatever string representation you want instead of the default one. Since format
already returns a value which is a string internally, no conversion takes place when it's printed.
format %b 0xa
fails instead or returning1010
. – Epithelium