How to use switch statement that match two values in one case with Swift

1 Answer

0 votes
let ch: Character = "b"

switch ch {
case "q":
    print("q")   
case "a", "b":
    print("a b")
case "c":
    print("c")    
case "z":
    print("z")
default:
    print("default")
}






/*
run:

a b

*/

 



answered Feb 10, 2021 by avibootz

Related questions

...