[CSharp/en]break and continue in loops

This commit is contained in:
Laoujin 2015-01-31 21:40:21 +01:00
parent 1d4bb253fd
commit 495e386121

View File

@ -244,8 +244,15 @@ on a new line! ""Wow!"", the masses cried";
int fooDoWhile = 0; int fooDoWhile = 0;
do do
{ {
//Iterated 100 times, fooDoWhile 0->99 // Start iteration 100 times, fooDoWhile 0->99
if (false)
continue; // skip the current iteration
fooDoWhile++; fooDoWhile++;
if (fooDoWhile == 50)
break; // breaks from the loop completely
} while (fooDoWhile < 100); } while (fooDoWhile < 100);
//for loop structure => for(<start_statement>; <conditional>; <step>) //for loop structure => for(<start_statement>; <conditional>; <step>)
@ -303,7 +310,7 @@ on a new line! ""Wow!"", the masses cried";
// Converting data // Converting data
// Convert String To Integer // 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" int.Parse("123");//returns an integer version of "123"
// try parse will default to type default on failure // try parse will default to type default on failure