Paul Bryant
28th February 2003, 12:42
Is it possible to have more than 1 case statement with the same output as I have multiple cases with the same output?

for example:

on case xxxxx123.xxxx
case "1", "2", "3":
output = "yyyyy"
endcase

RobertB
28th February 2003, 13:12
Yes!


on case xxxxx123.xxxx
case "1":
case "2":
case "3":
...
do something...
...
break
case "4":
case "5":
...
do something else...
...
break
case "99":
functionA()
break
default:

endcaseHave fun!!

zardoz
28th February 2003, 13:13
Yes. the sintax is a little bit different:

on case xxxxx123.xxxx
case "1":
case "2":
case "3":
output = "yyyyy"
break
....
case "99"
output = "xxxxx"
break
endcase

Note the use of break. It jumps at the endcase statement.

FransG
28th February 2003, 13:15
Use it as a fall-through mechanism, i.e. do not use a break. So in your case:



on case xxxxx123.xxxx
case "1":
case "2":
case "3":
output = "yyyyy"
break
case "4":
output = "zzzzz"
break
endcase


if xxxxx123.xxxx has value "1", "2" or "3" then output will become "yyyyy" if it has value "4" then output will become "zzzzz"; else output remains unchanged.

Paul Bryant
28th February 2003, 15:40
That has worked well.

Thanks for the help.

Regards
- Paul