Swift Program to Create Case With Multiple Values in the Switch Block

You are currently viewing Swift Program to Create Case With Multiple Values in the Switch Block

Swift program to create case with multiple values in the switch block

// Swift program to create case with 
// multiple values in switch block

var Num:Int=2;

switch Num {
    case 1:
    	print("One");
    case 2,3:
    	print("Two or Three");
    case 4:
    	print("Four");
    case 5:
    	print("Five");
    case 6:
    	print("Six");
    case 7:
    	print("Seven");
    default:
    	print("Unknown number");
}

Output

Two or Three

...Program finished with exit code 0
Press ENTER to exit console.

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply