Use of Break statement in switch statement
Explain the function of break statement in a switch statement with example?
Expert
Switch statement is the selection control statement which is used to handle several choices and move control to a case statements within its body.
Following code shows the example of the use of a switch statement in C#:
switch(choice)
{
case 1:
console.WriteLine("First");
break;
case 2:
console.WriteLine("Second");
default:
console.WriteLine("Wrong choice");
}
The break statement is used at the end of the case statement. Break statement is compulsory in C# and it avoids the fall through of one case statement to other.
Specify the new features involved in the Microsoft AJAX library?
Briefly describe login controls?
Illustrate the term Namespace also its uses?
How to identify that whether any changes are made or not to a DataSet object while it was last loaded?
How users of an application can be prevented from editing the text in the ComboBox controls in .NET 4.0?
Illustrate the reason in brief why WPF is used?
Distinguish between Boxing and Unboxing.
Illustrate the term LinqDataSource control?
What does a break statement do in the switch statement?
Distinguish the terms ADO.NET Dataset and an ADO Recordset?
18,76,764
1956401 Asked
3,689
Active Tutors
1447029
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!