Re: Problem with if/else
- From: "Alexandre Ferrieux" <alexandre.ferrieux@xxxxxxxxx>
- Date: 29 Mar 2007 13:32:24 -0700
On Mar 29, 7:43 pm, Glenn Jackman <gle...@xxxxxx> wrote:
if { "$stringA" == "$stringB" }
You don't need the quotes there. The act of substituting variables does
not introduce new word boundaries.
Beware that the two variants are not equivalent.
If you remove the quotes, the comparison may be done after conversion
to numerical values
For example,
% set stringA 16
% set stringB 0x10
% if {$stringA==$stringB} {puts yessss}
yessss
Moreover, not so long ago (threshold version please ?), the test could
even spark an exception on invalid conversions like "08" (invalid
octal number). Today (tested on my 8.4.14) invalid octals just refuse
to be converted and the comparison occurs in strings' realm. Much
sweeter !
-Alex
.
- References:
- Problem with if/else
- From: Dan
- Re: Problem with if/else
- From: Uwe Klein
- Re: Problem with if/else
- From: Glenn Jackman
- Problem with if/else
- Prev by Date: Re: want to spread my code over different files
- Next by Date: Re: TCL and IPv6
- Previous by thread: Re: Problem with if/else
- Next by thread: scrollbar question
- Index(es):
Relevant Pages
|