I’m not sure if anyone needs to use a switch statement, but here’s a way that works. If there is a single command, it can be included in the case line. If it’s multiple statements, it can be put into a function called from the case line. You can setup many switch statements by changing the name.
function setup()
switchLetter("A")
switchLetter("C")
switchNumber(1)
switchNumber(3)
end
function switchLetter(case)
_=( case=="A" and print("A selected") )
_=( case=="B" and print("B selected") )
_=( case=="C" and prC() )
end
function switchNumber(case)
_=( case==1 and print("1 selected") )
_=( case==2 and print("2 selected") )
_=( case==3 and pr3() )
end
function prC()
print("C selected")
print("C selected")
end
function pr3()
print("3 selected")
print("3 selected")
end