Am 08.11.2017 um 12:28 schrieb Bald Eagle:
> 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).
I would pick the analogy of a `#if...#elseif...#end` construct:
#switch(VALUE)
#case(COMPARE1)
// branch 1
#break
#case(COMPARE2)
// branch 2
#break
...
#default
// branch Z
#break
#end
is fully equivalent (presuming all values are numeric) to:
#if(VALUE=COMPARE1)
// branch 1
#elseif(VALUE=COMPARE2)
// branch 2
...
#else
// branch Z
#end
Post a reply to this message
|