|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
> #switch(0)
> #case(strcmp(IMG_TYPE,AA))
This should work, as strcmp(IMG_TYPE,AA) _IS_ 0.
> #switch(0)
> #case(strcmp(IMG_TYPE,AA)=0)
>
> I ask because the latter doesn't work--no error message of any kind is created,
> but it falls through to the #else clause, even though strcmp(IMG_TYPE,AA) is a
> 'match' between IMG_TYPE and AA.
Which means that it evaluates to TRUE, or 1, which is NOT 0.
Stop thinking in terms of conditional Boolean word results, and think in 0 or 1.
#if (strcmp(IMG_TYPE,AA)=0)
would give a Boolean result of 1.
I think you're stuck thinking about #switch() and #case() as some sort of
semi-Boolean operator, when it's more of a "pick this value from the following
list" function. Maybe if you think about the whole block like an array [n] and
the #case statements are picking a specific array item (sort of).
{pseudocode}
#if (Case = n)
#local Return = Array [n]
#end
and
#if (Range > Low & Range < High)
#local Return = Array [some appropriate n]
#end
Post a reply to this message
|
|