Re: WHILE and IF



Bryan Oakley <oakley@xxxxxxxxxxxxxxxxxxxx> wrote:
> If you look closely you'll see that you can use "then" if you
> so desire:
> if {$foo} then {do this} else {do that}

This shows that it is a bad idea to define a "then" and/or "else"
command that possibly take no arguments:
% proc then {} {puts ">then<"}
% proc else {} {puts ">then<"}
% if {1} {then} {else}
>else<
% if {1} {then } {else}
wrong # args: no script following "else" argument
% if {1} {then } {else }
>then<

If this weren't so already for a looong time, there would
hardly be any chance of adding such a feature nowadays.

.



Relevant Pages