Are nested SELECT/CASE's more efficient than a IF/THEN/ELSEIF/ELSE block structure?
Nested
Select Case's are exactly as awkward as nested
If/
ElseIf's
especially if the both are long and not properly indented (and preferably highlighted with indentation guides).
I usually frame the outer conditionals in a
Select Case block, and the inner ones, in
If/
ElseIf blocks if I have to. Also, I will
never ever use an editor that isn't equipped with auto-indentation and indentation guides features.
... consistent syntax trumps speed & obscurity.
For obvious reasons that I described in my previous message, the use of multiple
if/
else if's will not be considered good programming style in the C language. Long chains of conditionals should be framed in a
switch block while shorter and simpler
if/
else's are acceptable in the
case sub-blocks.
It's not a matter of obscurity or consistency but rather of implied functionality. Long
switch'es are generally executed faster than
if/
else if's due to inherent pre-scanning, even if not optimized into jump tables and computed
goto's altogether.