Nested Select Case語(yǔ)句可以將select語(yǔ)句作為外部select語(yǔ)句的語(yǔ)句序列的一部分。 即使內(nèi)部和外部選擇的情況常數(shù)包含公共值,也不會(huì)出現(xiàn)沖突。
示例:
Module decisions
Sub Main()
'local variable definition
Dim a As Integer = 100
Dim b As Integer = 200
Select a
Case 100
Console.WriteLine("This is part of outer case ")
Select Case b
Case 200
Console.WriteLine("This is part of inner case ")
End Select
End Select
Console.WriteLine("Exact value of a is : {0}", a)
Console.WriteLine("Exact value of b is : {0}", b)
Console.ReadLine()
End Sub
End Module
This is part of outer case
This is part of inner case
Exact value of a is : 100
Exact value of b is : 200
更多建議: