|
|
After re-reading the various comments, and experimenting with all sorts of
combinations of things, I have to admit that all of this stuff is still a bit
difficult to wrap my mind around-- mainly because there's a specific stumbling
block or two that's giving me a problem.
I've come up with some examples that probably go to the root cause of my
remaining misunderstanding.
My basic question is: When is the #switch() value considered an actual Boolean
true/false value, vs. a 'simple numerical' value?
Getting back to basics-- e.g., NOT using the strcmp() string-compare function to
complicate things-- consider the following:
#declare C = 27;
(A)
This works successfully...
#switch(1) // Boolean 'true'
#case(C = 27) // a Boolean comparison that's also 'true'
(B)
This ALSO works... two 'numerical values' that match
#switch(27)
#case(C)
(C)This does NOT work (it falls through to the #else clause)...
#switch(1000) // or 343 or -89 or any other non-zero value
#case(C = 27) // the Boolean comparison again
Regarding (A) and (B), it appears that #switch 'changes its operational mode'--
depending on the particular 'kind' of #case that it's presented with (Boolean
true/false vs. a simple number.) Currently, I'm not exactly sure when that might
happen, given the complexities of all of this inter-related stuff.
Regarding (C), I was under the impression from some earlier comments that
#switch could use ANY positive/negative value to mean 'true' or (1)-- but that
doesn't seem to be a correct interpretation. It seems that only #switch(1)
works.
If I could just get past *these* misunderstandings, my world would be a MUCH
happier place to be in ;-)
Post a reply to this message
|
|