Reputation: 3235
I am reading "Tcl/Tk: A developer's guide", in chapter 3.1, it has such bad example:
if {$x > 2} {
set greater true
}
The book says this code is wrong syntax because "No space between test and body left brace
" and will get error message:
Error Message: invalid command name "}"
I tried it in tclsh, it works fine. Also I do not think "{$x
" is wrong, "{" is at the start position of a word, so whatever stuff till the matching "}" is enclosed.
Do you see anything wrong?
Upvotes: 0
Views: 63
Reputation: 16428
In the book, it is given without spaces only.
Running this we will the get the following errors.
% if {$x > 2}{
extra characters after close-brace
% set greater true
true
% }
invalid command name "}"
%
Upvotes: 1