Using break to exit a do-while loop
/*
C#: The Complete Reference
by Herbert Schildt
Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Using break to exit a do-while loop.
using System;
public class BreakDemo2 {
public static void Main() {
int i;
i = -10;
do {
if(i > 0) break;
Console.Write(i + " ");
i++;
} while(i <= 10);
Console.WriteLine("Done");
}
}
Related examples in the same category