Goto Tester

image_pdfimage_print

/*
Learning C#
by Jesse Liberty

Publisher: O'Reilly
ISBN: 0596003765
*/
using System;
public class GotoTester
{

public static void Main()
{
int counterVariable = 0;

repeat: // the label

Console.WriteLine(
“counterVariable: {0}”,counterVariable);

// increment the counter
counterVariable++;

if (counterVariable < 10) goto repeat; // the dastardly deed } } [/csharp]