VB.Net Program to Use a Comma ‘,’ to Use Multiple Options in ‘Select Case’

You are currently viewing VB.Net Program to Use a Comma ‘,’ to Use Multiple Options in ‘Select Case’

VB.Net program to use a comma ‘,’ to use multiple options in ‘select case’

'VB.Net program to use a comma "," to use 
'multiple options in "select case".

Module Module1

    Sub Main()
        Dim choice As Char

        Console.WriteLine("############################")
        Console.WriteLine("     a: India")
        Console.WriteLine("     b: Australia")
        Console.WriteLine("     c,d: USA")
        Console.WriteLine("############################")
        Console.Write("Select your country: ")
        choice = Char.Parse(Console.ReadLine())

        Select Case choice
            Case "a"
                Console.WriteLine("India")
            Case "b"
                Console.WriteLine("Australia")
            Case "c", "d"
                Console.WriteLine("USA")
            Case Else
                Console.WriteLine("Invalid choice")
        End Select
    End Sub
    
End Module

Output

############################
     a: India
     b: Australia
     c,d: USA
############################
Select your country: d
USA
Press any key to continue . . .

Ranjith Kumar

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

Leave a Reply