Re: SWITCH question

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

The PRIMARY method of switch is:

Case 1: JUST do Case_1 things (If that is all you want it to do, then signal "SUCCESS" and LEAVE the switch.
This goes for any SINGLE-action situation.
In this way it is no more tan a LIST of IF...Endif's

BUT if you let SWITCH do what it is capable of, it will go on doing case_2 things that need to be done (immediately) after case_1 was either T or F
YOU decide whether to go on and perform its next "task" (New piece of code OR error-handling, before entering case_3.

IF a condition is not met successfully, THAT particular case drops out of SWITCH with a FALSE result and the module/line & error causing it, and WHERE YOU caused it (WHICH Handle and pointer and the kind of violation (EG x/0 or DIV(0,x) and DIV(x,0). A second example, it would send you a TYPE-mismatch message.

Does that clarify its METHOD(s) sufficiently?

Example: I want you go buy something for me, but forget to give you (necessary) money in advance:

The correct coding would be:

Does X have sufficient money to pay for what I asked him to buy for me?
If NOT provide him with it before sending him off.
On X's return, ask him for the goods AND ONLY if he hasn't bought EXACTLY what I told him
AND that would make it impossible for me to do what I need to do in the end,
throw an error-message: Operation impossible by X not doing what X ought to do (neither having done so) AND have him fetch the correct {tool,material,support}
JOB FINISHED SUCCESSFULLY

Does this example blow away the clouds or nebulae on Switches FULL METHOD?

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

Search



Quick Links

User menu

Not signed in.

Misc Menu