Visual Basic 嵌套 Select Case 语句
可以将 select 语句作为外部 select 语句的语句序列的一部分。即使内部和外部选择的情况常量包含共同的值,也不会产生冲突。
实例
Module decisionsSub Main()'local variable definitionDim a As Integer = 100Dim b As Integer = 200Select aCase 100Console.WriteLine("This is part of outer case ")Select Case bCase 200Console.WriteLine("This is part of inner case ")End SelectEnd SelectConsole.WriteLine("Exact value of a is : {0}", a)Console.WriteLine("Exact value of b is : {0}", b)Console.ReadLine()End SubEnd Module
结果如下:
This is part of outer caseThis is part of inner caseExact value of a is : 100Exact value of b is : 200