Declaring Enumerations
An enumerated type is
declared using the Enum statement. The Enum statement declares
an enumeration and defines the values of its members. The Enum statement can be
used at the module, class, structure, procedure, or block level.
Example
The following example
demonstrates declaration and use of the Enum variable Colors:
Module constantsNenum
Enum Colors
red = 1
orange = 2
yellow = 3
green = 4
azure = 5
blue = 6
violet = 7
End Enum
Sub Main()
Console.WriteLine("The Color Red is : " & Colors.red)
Console.WriteLine("The Color Yellow is : " & Colors.yellow)
Console.WriteLine("The Color Blue is : " & Colors.blue)
Console.WriteLine("The Color Green is : " & Colors.green)
Console.ReadKey()
End Sub
End Module
When the above code
is compiled and executed, it produces the following result:
The Color Red is: 1
The Color Yellow is: 3
The Color Blue is: 6
The Color Green is: 4
0 comments
Post a Comment