Vowel - switch Learn programming Visual Basic (VB.net)

Lesson:

Basic Data Types


Exercise:

Vowel - switch


Objetive:

Create a Visual Basic (VB.net) program to ask the user for a symbol and respond whether it is a vowel (in lowercase), a digit, or any other symbol, using "switch".


Code:

Imports System
Public Class exercise60
    Public Shared Sub Main()
        Dim symbol As Char
        Console.Write("Enter a symbol: ")
        symbol = Convert.ToChar(Console.ReadLine())

        Select Case symbol
            Case "a"c, "e"c, "i"c, "o"c, "u"c
                Console.WriteLine("It's a lowercase vowel.")
            Case "0"c, "1"c, "2"c, "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, "9"c
                Console.WriteLine("It's a digit.")
            Case Else
                Console.Write("It's another symbol.")
        End Select
    End Sub
End Class

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.