J
Just_a_fan
As they say in South Park... "Well, I learned something today."
This is valid in both VB6 and 9 versions:
Select Case TrySelect
Case 1, 3
Debug.Print "1"
Case 2
Debug.Print "2"
Case 3
Debug.Print "3"
End Select
Of course, the "Case 3" never gets executed due to the "Case 1, 3"
catching the 3. I cannot imagine it is even legal to code but does not
even get a simple warning flag in VB9. Good languages will flag code
that cannot get executed. VB6 and 9 both ignore the situation.
Calling this with 1 then 2 then 3 prints 1 then 2 then 1 again.
I accidentally left a duplicate of a Case "test expression" in a program
I am working on. It was a leftover from a change I made some time back.
It had no code in it so I did not notice it until I was reworking the
routine a bit, yesterday. I was amazed that this is even allowed. It
is not allowed in at least one other language I have worked in, possibly
two others. What's the point?
Live and learn!
Mike
This is valid in both VB6 and 9 versions:
Select Case TrySelect
Case 1, 3
Debug.Print "1"
Case 2
Debug.Print "2"
Case 3
Debug.Print "3"
End Select
Of course, the "Case 3" never gets executed due to the "Case 1, 3"
catching the 3. I cannot imagine it is even legal to code but does not
even get a simple warning flag in VB9. Good languages will flag code
that cannot get executed. VB6 and 9 both ignore the situation.
Calling this with 1 then 2 then 3 prints 1 then 2 then 1 again.
I accidentally left a duplicate of a Case "test expression" in a program
I am working on. It was a leftover from a change I made some time back.
It had no code in it so I did not notice it until I was reworking the
routine a bit, yesterday. I was amazed that this is even allowed. It
is not allowed in at least one other language I have worked in, possibly
two others. What's the point?
Live and learn!
Mike