Re: SWITCH question

new topic     » goto parent     » topic index » view thread      » older message » newer message

I stand corrected by the facts about the switch-method because I assumed it was an intricate kind of error-handler, whereas it is in fact just a neater way to program nested if..elsif....else...endif constructions, yielding TRUE or FALSE, and reacting to the result of that test.

This, however explains both its erratic behaviour and the fact that there are 2 different values returned. If I take the highest and call that TRUE (it might be the pointer to TRUE as well!) automagically the lower one will be (the maybe pointer to) FALSE. But because it made you end up in the constant-table it is ofc a pointer. Having been too long `off scene` I assumed it still was Eu and not OE, that's why I pointed at RC and not at Derek as its creator.

So the correct use of switch is: Switch (a) ....case (x) ....case (y) ....case (z) default endswitch

BUT NEVER Switch (a) .... case (a) or any condition containing (a) again because (a) has been checked by SWITCH already and will therefore inevitably send a TRUE, followed by the test-result of the next condition.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu