Code

goto Statement

There is another jump statement called goto statement, which enables you to jump directly to another specified line in the program, indicated by a label.

switch goto statement

Run Demo

OUTPUT

Case: C

Just for fun

    goto One;
    Console.WriteLine("This won't be executed");

One:
    Console.WriteLine("1");
    goto Two;

Four:
    Console.WriteLine("4");
    goto Total;

Two:
    Console.WriteLine("2");
    goto Three;

Three:
    Console.WriteLine("3");
    goto Four;

Total:
    Console.WriteLine("----");
    Console.WriteLine("10");

Run Demo

OUTPUT

1
2
3
4
—-
10

Add Comment

Click here to post a comment

Subscribe

Most Popular

Popular Video