The tcl 8.5 docu doesn't prefer either of the 2 possibilities. To quote the documentation:
The then and else arguments are optional “noise words” to make the command easier to read.
And I'd take that literally. They are meant to make code easier to read, that means either always use them or never. ^-^
Code: Select all
if {
$vbl == 1 || $vbl == 2 || $vbl == 3
} then {
puts "vbl is one, two or three"
}
Is imho a really really bad idea, because the eye catchs
Code: Select all
if {} {
$vbl == 1 || $vbl == 2 || $vbl == 3
} else {
puts "vbl is one, two or three"
}
which isn't meant at all. I'd suggest to write something like the following:
Code: Select all
if {$vbl == 1 || $vbl == 2
|| $vbl == 3} {
puts "vbl is one, two or three"
}
I split the line, because I wanted to start the 2nd line of the condition with a || or && to don't make the impression of just wrong indention. This follows a often used rule to use the double indention for multiple line for a single command.
PS: I personally would always use else, unless you want to write some quick code which just works but doesn't have to be maintained.