diff options
author | Laoujin <woutervs@hotmail.com> | 2015-01-31 21:40:21 +0100 |
---|---|---|
committer | Laoujin <woutervs@hotmail.com> | 2015-01-31 21:40:21 +0100 |
commit | 495e38612160ac373325543de3c5b88e0ef6ed35 (patch) | |
tree | d8607b7fea57e84556b98b8de1df3de9f86d22f1 | |
parent | 1d4bb253fd8b6053e5a38d206ffc15360d3bd6fd (diff) |
[CSharp/en]break and continue in loops
-rw-r--r-- | csharp.html.markdown | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/csharp.html.markdown b/csharp.html.markdown index 88c2db35..9f66b8ff 100644 --- a/csharp.html.markdown +++ b/csharp.html.markdown @@ -244,8 +244,15 @@ on a new line! ""Wow!"", the masses cried"; int fooDoWhile = 0; do { - //Iterated 100 times, fooDoWhile 0->99 + // Start iteration 100 times, fooDoWhile 0->99 + if (false) + continue; // skip the current iteration + fooDoWhile++; + + if (fooDoWhile == 50) + break; // breaks from the loop completely + } while (fooDoWhile < 100); //for loop structure => for(<start_statement>; <conditional>; <step>) @@ -303,7 +310,7 @@ on a new line! ""Wow!"", the masses cried"; // Converting data // Convert String To Integer - // this will throw an Exception on failure + // this will throw a Exception on failure int.Parse("123");//returns an integer version of "123" // try parse will default to type default on failure |