Vb.net-nested-select-case-statements
提供:Dev Guides
VB.Net-ネストされた選択ケースステートメント
外部のselectステートメントのステートメントシーケンスの一部としてselectステートメントを持つことができます。 内部選択と外部選択のケース定数に共通の値が含まれていても、競合は発生しません。
例
上記のコードをコンパイルして実行すると、次の結果が生成されます-
外部のselectステートメントのステートメントシーケンスの一部としてselectステートメントを持つことができます。 内部選択と外部選択のケース定数に共通の値が含まれていても、競合は発生しません。
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