Problem with switch
Posted: Wed Jul 16, 2008 5:26 am
I have some code to check the contents
of variables tVar1[Line01] to tVar1[Line11].
The contents of the elements of tVar1 are
either 1 or 0. There can be one or two cases
where the variable is 1.
The switch code is
case tVar[Line01] > 0
do the biz
...
case tVar[Line11] > 0
do the biz
Problem is that if Line07 is 1 the code is run OK
but then all the following case statements
code is run even though the variable value is 0.
So in a case where Line6 and Line7 are set to
1 the result I get is 6 and 11 instead of 6 and 7.
Seems that after finding one case where
the variable is 1 it ignores the "case" condition
for all the remaining case statements.
Can't use "break" after the first "1" value is
found since the second case won't be checked.
Any ideas?
of variables tVar1[Line01] to tVar1[Line11].
The contents of the elements of tVar1 are
either 1 or 0. There can be one or two cases
where the variable is 1.
The switch code is
case tVar[Line01] > 0
do the biz
...
case tVar[Line11] > 0
do the biz
Problem is that if Line07 is 1 the code is run OK
but then all the following case statements
code is run even though the variable value is 0.
So in a case where Line6 and Line7 are set to
1 the result I get is 6 and 11 instead of 6 and 7.
Seems that after finding one case where
the variable is 1 it ignores the "case" condition
for all the remaining case statements.
Can't use "break" after the first "1" value is
found since the second case won't be checked.
Any ideas?