Re: SWITCH question

new topic     » goto parent     » topic index » view thread      » older message » newer message
Ekhnat0n said...

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, and reacting to the result of that test.

Yeah, pretty much.

Ekhnat0n said...

yielding TRUE or FALSE,

The values don't have to be true or false, as the equality test is internal.

Ekhnat0n said...

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.

Uh, no. That's not how it works.

Ekhnat0n said...

But because it made you end up in the constant-table it is ofc a pointer.

There isn't a constant-table. (There is a list of symbol names used for error reporting, but that's not the cause of the problem.)

Ekhnat0n said...

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.

OE was scooby's deal.

Ekhnat0n said...

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.

Actually, as long as a is a literal value or a constant/enum, the second case should be ok!

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

Search



Quick Links

User menu

Not signed in.

Misc Menu