using System;
class Program
{
static void Main()
{
Console.WriteLine("what do you want to learn?");
int n = int.Parse(Console.ReadLine());
switch (n)
{
case 1:
Console.WriteLine("Learn C#");
break;
case 2:
Console.WriteLine("Learn SqlServer");
goto case 1;
case 3:
Console.WriteLine("Learn ASP.net");
goto case 2;
default:
Console.WriteLine("Invalid selection.");
break;
}
Console.ReadKey();
}
}
|
Class Program
Private Shared Sub Main()
Console.WriteLine("what do you want to learn?")
Dim n As Integer = Integer.Parse(Console.ReadLine())
Select Case n
Case 1
Console.WriteLine("Learn C#")
Exit Select
Case 2
Console.WriteLine("Learn SqlServer")
goto case 1
Case 3
Console.WriteLine("Learn ASP.net")
goto case 2
Case Else
Console.WriteLine("Invalid selection")
Exit Select
End Select
Console.ReadKey()
End Sub
End Class
|