---- Original Message ----
Sent: Tuesday, 2011. March 8. 04:12
Subject: RE: [Suggestions-t-2656] SWITCH enhancement?
| Hallo TimButterfield,
|| How about reversing the flag usage? Set the flag before SWITCH.
|| Set a DEFAULT block to clear the flag. Then, after the ENDSWITCH, if
|| the flag is still set (any non-DEFAULT case value), do your ANY block
| Since you have to test for the flag after ENDSWITCH anyway, it's
| still more simple to set the flag in DEFAULT, and act on its presence
| or absence after ENDSWITCH.
As Vince described the issue, no, he would not need to use a flag at all. See below:
In solving some problems this enhanced syntax would be useful. OTOH it would require major redesign of TCC. If such were done, I would opt for the one or more implementing of the schemes described below.
Enhance string matching of cases by a /C(asesensitive) option. The option could be specified in the individual CASE statement, and apply to the specific statement only, or in the SWITCH statement, and apply to each CASE statement in scope. Effect should NOT be nested, i.e., if a CASE or DEFAULT block includes another SWITCH statement, it would default to the current case insensitive matching.
The comparison expression in each CASE statement enhanced to include ranges and simple magnitude / ordering tests (for numeric and string control expressions, resp.). See example with numeric variable below:
CASE LT 5
CASE IN 5 TO 99 OR 110 OR GT 210
Each CASE statement has its own conditional expression controlling whether or not its associated code block is to be executed. In its simpler form each test included in a conditional expression implicitly refers to the control expression in the SWITCH statement. The more complex for would involve no control expression in the SWITCH statement itself at all. This last form makes each SWITCH similar to an
IFF ... ELSEIFF ... ELSEIFF ... ELSEIFF ... ELSE
This scheme performs the associated code block of each CASE in the structure whose condition is met, in the order in which they are found. The condition test could be the one used now, or as enhanced by any one or more of the above schemes. This scheme could also include using a counter of executed cases, allowing a latter CASE block to be executed based on the number of prior CASE blocks executed. In Vince's task that number would be 1 (one).