Welcome to Kode CSharp
Kode CSharp website provides beginners to C# programming some examples to use the C# API (Application Programming Interface) to develop applications. Learning from some examples will hopefully decrease the time required to learn C#.
In this website you will find a lot of examples which grouped by the C# API namespace. You can easily find a solution to your problem.
Enjoy your study, come and visit the site regularly to find more and more examples of C# code.
--
I Wayan Saryada
Kode CSharp Webmaster
Latest Code Examples
How do I terminate a loop using break statement?
The break statement terminates the enclosing loop or switch statement. After the break executed the control will be transferred to the next statement after the terminated loop or switch.
In the example below we initially want to do an iteration while the value of i is less than 50, so it equals to 50 iteration. But we also have a conditional check inside that loop that tells to exit the loop is i equals to 10.
To see a break inside a switch statement you can see at the following example, How do I use switch statement?.
The result:
i = 0 i = 1 i = 2 i = 3 i = 4 i = 5 i = 6 i = 7 i = 8 i = 9