I see the following in a Tcl script:
If { <some_condition> } {
// code here...
} {
// code here...
}
I am assuming this is a special case of if-else
syntax? Would just like to get confirmation.
This is indeed just a variation on if
-else
syntax; the else
is optional (as is the then
, which virtually everyone omits but I like to use when I have a multi-line expression before it). It's usually a good idea to include it as that's less visually confusing, but you don't need it.
The only “keywords” in if
syntax that are mandatory are if
(you could rename
that, but it would break all sorts of things) and elseif
(for extra condition checks).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With