Re: misunderstaning of switch command

Liste des GroupesRevenir à cl tcl 
Sujet : Re: misunderstaning of switch command
De : nospam.nurdglaw (at) *nospam* gmail.com (Alan Grunwald)
Groupes : comp.lang.tcl
Date : 24. Jun 2025, 11:44:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103dvk1$1v0s8$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 24/06/2025 10:08, Harald Oehlmann wrote:
Sorry, typo in my last post:
 
The "if" command takes his first argument and passes it to "expr".
Then, eval will do the variable expansion.
 Correct:
-> Then, expr will do the variable expansion.
 
Just one additional trick for a Tcl newbie to consider...
The OP had several lines like
         $::SAME_AS_PREV { puts "unchanged \"$filename\"" }
which have now morphed (typically) into
         if {$kind eq $::SAME_AS_PREV} {
             puts "unchanged \"$filename\""
I have got into the habit of using the [format] command to build strings that have fixed and variable parts - it's kind of analagous to sprintf in C. This would lead me to change the output command to
             puts [format {unchanged "%s"} $filename]
I believe it's easier to make out what's going on without all the backslashes that are otherwise needed around the quotes that surround the filename. (You can't exchange the outer quotes for curly brackets because that would prevent the Tcl interpreter from expanding $filename.]
Hope you find this helpful.
Alan

Date Sujet#  Auteur
24 Jun 25 * misunderstaning of switch command10Mark Summerfield
24 Jun 25 +* Re: misunderstaning of switch command6Harald Oehlmann
24 Jun 25 i`* Re: misunderstaning of switch command5Mark Summerfield
24 Jun 25 i +* Re: misunderstaning of switch command3Harald Oehlmann
24 Jun 25 i i`* Re: misunderstaning of switch command2Harald Oehlmann
24 Jun 25 i i `- Re: misunderstaning of switch command1Alan Grunwald
24 Jun 25 i `- Re: misunderstaning of switch command1Robert Heller
24 Jun 25 +* Re: misunderstaning of switch command2Schelte
24 Jun 25 i`- Re: misunderstaning of switch command1Harald Oehlmann
24 Jun 25 `- Re: misunderstaning of switch command1Robert Heller

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal