Comment with
one word outside a block in the switch ...
set mode "start"
switch -exact -- $mode {
start {
puts "start mode"
return "" ;# Nothing specific
}
# comment
}
... No errors.
Comment with
2+ words outside a block in the switch ...
set mode "start"
switch -exact -- $mode {
start {
puts "start mode"
return "" ;# Nothing specific
}
# a comment
}
... generates an error ...
extra switch pattern with no body, this may be due to a comment incorrectly placed outside of a switch body - see the "switch" documentation
while executing
"switch -exact -- $mode {
start {
puts "start mode"
return "" ;# Nothing specific
}
# a comment
..."
(file "tmp.tcl" line 3)
. Can anyone explain what is happening?