En C#, la declaración de continuación se usa la declaración)
continue;
Diagrama de flujo:
Ejemplo 1:
C#
// C# program to illustrate the use // of continue statement in for loop using System; class GFG{ static public void Main () { // Here, in this for loop start from 2 to 12, // due to the continue statement, when x = 8 // it skip the further execution of the statements // and transfer the controls back to the // next iteration of the for loop for(int x = 2; x <= 12; x++) { if (x == 8) { continue; } Console.WriteLine(x); } } }
Producción:
2 3 4 5 6 7 9 10 11 12
Ejemplo 2:
C#
// C# program to illustrate the use // of continue statement in while loop using System; class GFG{ static public void Main () { int x = 0; // Here, using continue statement // whenever the value of x<2, it // skips the further execution of the // statements and the control transfer // to the next iteration of while loop while (x < 8) { x++; if (x < 2) continue; Console.WriteLine(x); } } }
Producción:
2 3 4 5 6 7 8
Publicación traducida automáticamente
Artículo escrito por ankita_saini y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA