Implementation request for the SWITCH statement
Posted: Mon Jul 27, 2020 2:45 pm
Hi, Robert and dev. Team,
the SWITCH statement is very powerful, but sometimes not comfortable to use (compared to the DO CASE):
FUNCTION ActonChoice(nChoice as LONG) AS VOID
SWITCH nChoice
CASE 0
RETURN
CASE 1
ChoiceOne()
CASE 2
ChoiceTwo()
CASE 3
CASE 4
CASE 5
..........
CASE 100
ChoiceOverFour()
CASE 101
............
CASE 1000
ChoiceOVER()
END SWITCH
My request is if it were possible to simplify in this way:
FUNCTION ActonChoice(nChoice as LONG) AS VOID
SWITCH nChoice
CASE 0
RETURN
CASE 1
ChoiceOne()
CASE 2
ChoiceTwo()
CASE 3 TO 100
ChoiceOverFour()
CASE 101 TO 1000
ChoiceOVER()
END SWITCH
best regards,
Fabrizio
the SWITCH statement is very powerful, but sometimes not comfortable to use (compared to the DO CASE):
FUNCTION ActonChoice(nChoice as LONG) AS VOID
SWITCH nChoice
CASE 0
RETURN
CASE 1
ChoiceOne()
CASE 2
ChoiceTwo()
CASE 3
CASE 4
CASE 5
..........
CASE 100
ChoiceOverFour()
CASE 101
............
CASE 1000
ChoiceOVER()
END SWITCH
My request is if it were possible to simplify in this way:
FUNCTION ActonChoice(nChoice as LONG) AS VOID
SWITCH nChoice
CASE 0
RETURN
CASE 1
ChoiceOne()
CASE 2
ChoiceTwo()
CASE 3 TO 100
ChoiceOverFour()
CASE 101 TO 1000
ChoiceOVER()
END SWITCH
best regards,
Fabrizio